diff --git "a/Extracted/Mathlib/TacticPrediction/Mathlib_Algebra_Algebra_Operations.jsonl" "b/Extracted/Mathlib/TacticPrediction/Mathlib_Algebra_Algebra_Operations.jsonl" new file mode 100644--- /dev/null +++ "b/Extracted/Mathlib/TacticPrediction/Mathlib_Algebra_Algebra_Operations.jsonl" @@ -0,0 +1,196 @@ +{"state":"R : Type u\nA : Type v\ninst✝² : CommSemiring R\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nx : A\nr : R\n⊢ (fun r => r • 1) r = x ↔ (algebraMap R A) r = x","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by ","nextTactic":"rw [algebraMap_eq_smul_one]","declUpToTactic":"theorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.63_0.IvhXmXo9kppbroj","decl":"theorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\n⊢ 1 ≤ 1.toAddSubmonoid","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n ","nextTactic":"rintro x ⟨n, rfl⟩","declUpToTactic":"theorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.91_0.IvhXmXo9kppbroj","decl":"theorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid "} +{"state":"case intro\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n✝ : A\nn : ℕ\n⊢ (Nat.castAddMonoidHom A) n ∈ 1.toAddSubmonoid","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n ","nextTactic":"exact ⟨n, map_natCast (algebraMap R A) n⟩","declUpToTactic":"theorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.91_0.IvhXmXo9kppbroj","decl":"theorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\n⊢ 1 = span R {1}","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n ","nextTactic":"apply Submodule.ext","declUpToTactic":"theorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.110_0.IvhXmXo9kppbroj","decl":"theorem one_eq_span : (1 : Submodule R A) = R ∙ 1 "} +{"state":"case h\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\n⊢ ∀ (x : A), x ∈ 1 ↔ x ∈ span R {1}","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n ","nextTactic":"intro a","declUpToTactic":"theorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.110_0.IvhXmXo9kppbroj","decl":"theorem one_eq_span : (1 : Submodule R A) = R ∙ 1 "} +{"state":"case h\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n a : A\n⊢ a ∈ 1 ↔ a ∈ span R {1}","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n ","nextTactic":"simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]","declUpToTactic":"theorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.110_0.IvhXmXo9kppbroj","decl":"theorem one_eq_span : (1 : Submodule R A) = R ∙ 1 "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\n⊢ 1 ≤ P ↔ 1 ∈ P","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n ","nextTactic":"simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]","declUpToTactic":"theorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.120_0.IvhXmXo9kppbroj","decl":"theorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P "} +{"state":"ι : Sort uι\nR : Type u\ninst✝⁴ : CommSemiring R\nA : Type v\ninst✝³ : Semiring A\ninst✝² : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\nA' : Type u_1\ninst✝¹ : Semiring A'\ninst✝ : Algebra R A'\nf : A →ₐ[R] A'\n⊢ map (AlgHom.toLinearMap f) 1 = 1","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ","nextTactic":"ext","declUpToTactic":"protected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.125_0.IvhXmXo9kppbroj","decl":"protected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 "} +{"state":"case h\nι : Sort uι\nR : Type u\ninst✝⁴ : CommSemiring R\nA : Type v\ninst✝³ : Semiring A\ninst✝² : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\nA' : Type u_1\ninst✝¹ : Semiring A'\ninst✝ : Algebra R A'\nf : A →ₐ[R] A'\nx✝ : A'\n⊢ x✝ ∈ map (AlgHom.toLinearMap f) 1 ↔ x✝ ∈ 1","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n ","nextTactic":"simp","declUpToTactic":"protected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.125_0.IvhXmXo9kppbroj","decl":"protected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\n⊢ map (↑(opLinearEquiv R)) 1 = 1","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ","nextTactic":"ext x","declUpToTactic":"@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.131_0.IvhXmXo9kppbroj","decl":"@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 "} +{"state":"case h\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\nx : Aᵐᵒᵖ\n⊢ x ∈ map (↑(opLinearEquiv R)) 1 ↔ x ∈ 1","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n ","nextTactic":"induction x using MulOpposite.rec'","declUpToTactic":"@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.131_0.IvhXmXo9kppbroj","decl":"@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 "} +{"state":"case h.h\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n X✝ : A\n⊢ op X✝ ∈ map (↑(opLinearEquiv R)) 1 ↔ op X✝ ∈ 1","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n ","nextTactic":"simp","declUpToTactic":"@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.131_0.IvhXmXo9kppbroj","decl":"@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\n⊢ comap (↑(opLinearEquiv R)) 1 = 1","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ","nextTactic":"ext","declUpToTactic":"@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.139_0.IvhXmXo9kppbroj","decl":"@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 "} +{"state":"case h\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n x✝ : A\n⊢ x✝ ∈ comap (↑(opLinearEquiv R)) 1 ↔ x✝ ∈ 1","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n ","nextTactic":"simp","declUpToTactic":"@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.139_0.IvhXmXo9kppbroj","decl":"@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\n⊢ map (↑(LinearEquiv.symm (opLinearEquiv R))) 1 = 1","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ","nextTactic":"rw [← comap_equiv_eq_map_symm]","declUpToTactic":"@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.146_0.IvhXmXo9kppbroj","decl":"@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\n⊢ comap (↑(opLinearEquiv R)) 1 = 1","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n ","nextTactic":"rw [comap_op_one]","declUpToTactic":"@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.146_0.IvhXmXo9kppbroj","decl":"@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\n⊢ comap (↑(LinearEquiv.symm (opLinearEquiv R))) 1 = 1","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n ","nextTactic":"rw [← map_equiv_eq_comap_symm]","declUpToTactic":"@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.153_0.IvhXmXo9kppbroj","decl":"@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\n⊢ map (↑(opLinearEquiv R)) 1 = 1","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n ","nextTactic":"rw [map_op_one]","declUpToTactic":"@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.153_0.IvhXmXo9kppbroj","decl":"@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] A��ᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM✝ N✝ P Q : Submodule R A\nm n : A\nM N : Submodule R A\n⊢ (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n ","nextTactic":"dsimp [HMul.hMul, Mul.mul]","declUpToTactic":"theorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.174_0.IvhXmXo9kppbroj","decl":"theorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM✝ N✝ P Q : Submodule R A\nm n : A\nM N : Submodule R A\n⊢ (map₂ (LinearMap.mul R A) M N).toAddSubmonoid = ⨆ s, AddSubmonoid.map (AddMonoidHom.mulLeft ↑s) N.toAddSubmonoid","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n ","nextTactic":"rw [map₂]","declUpToTactic":"theorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.174_0.IvhXmXo9kppbroj","decl":"theorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM✝ N✝ P Q : Submodule R A\nm n : A\nM N : Submodule R A\n⊢ (⨆ s, map ((LinearMap.mul R A) ↑s) N).toAddSubmonoid =\n ⨆ s, AddSubmonoid.map (AddMonoidHom.mulLeft ↑s) N.toAddSubmonoid","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n ","nextTactic":"rw [iSup_toAddSubmonoid]","declUpToTactic":"theorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.174_0.IvhXmXo9kppbroj","decl":"theorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM✝ N✝ P Q : Submodule R A\nm n : A\nM N : Submodule R A\n⊢ ⨆ i, (map ((LinearMap.mul R A) ↑i) N).toAddSubmonoid =\n ⨆ s, AddSubmonoid.map (AddMonoidHom.mulLeft ↑s) N.toAddSubmonoid","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n ","nextTactic":"rfl","declUpToTactic":"theorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.174_0.IvhXmXo9kppbroj","decl":"theorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\nC : A → Prop\nr : A\nhr : r ∈ M * N\nhm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)\nha : ∀ (x y : A), C x → C y → C (x + y)\n⊢ C r","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n ","nextTactic":"rw [← mem_toAddSubmonoid] at hr","declUpToTactic":"@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.182_0.IvhXmXo9kppbroj","decl":"@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\nC : A → Prop\nr : A\nhr : r ∈ (M * N).toAddSubmonoid\nhm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)\nha : ∀ (x y : A), C x → C y → C (x + y)\n⊢ C r","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n ","nextTactic":"rw [mul_toAddSubmonoid] at hr","declUpToTactic":"@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.182_0.IvhXmXo9kppbroj","decl":"@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\nC : A → Prop\nr : A\nhr : r ∈ M.toAddSubmonoid * N.toAddSubmonoid\nhm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)\nha : ∀ (x y : A), C x → C y → C (x + y)\n⊢ C r","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n ","nextTactic":"exact AddSubmonoid.mul_induction_on hr hm ha","declUpToTactic":"@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.182_0.IvhXmXo9kppbroj","decl":"@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\nC : (r : A) → r ∈ M * N → Prop\nhm : ∀ (m : A) (hm : m ∈ M) (n : A) (hn : n ∈ N), C (m * n) (_ : m * n ∈ M * N)\nha : ∀ (x : A) (hx : x ∈ M * N) (y : A) (hy : y ∈ M * N), C x hx → C y hy → C (x + y) (_ : x + y ∈ M * N)\nr : A\nhr : r ∈ M * N\n⊢ C r hr","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) �� ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n ","nextTactic":"refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc","declUpToTactic":"/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.190_0.IvhXmXo9kppbroj","decl":"/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\nC : (r : A) → r ∈ M * N → Prop\nhm : ∀ (m : A) (hm : m ∈ M) (n : A) (hn : n ∈ N), C (m * n) (_ : m * n ∈ M * N)\nha : ∀ (x : A) (hx : x ∈ M * N) (y : A) (hy : y ∈ M * N), C x hx → C y hy → C (x + y) (_ : x + y ∈ M * N)\nr : A\nhr : r ∈ M * N\n⊢ ∃ (x : r ∈ M * N), C r x","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n ","nextTactic":"exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩","declUpToTactic":"/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.190_0.IvhXmXo9kppbroj","decl":"/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\n⊢ 1 * M = M","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n ","nextTactic":"conv_lhs => rw [one_eq_span, ← span_eq M]","declUpToTactic":"protected theorem one_mul : (1 : Submodule R A) * M = M := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.223_0.IvhXmXo9kppbroj","decl":"protected theorem one_mul : (1 : Submodule R A) * M = M "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\n| 1 * M","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => ","nextTactic":"rw [one_eq_span, ← span_eq M]","declUpToTactic":"protected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.223_0.IvhXmXo9kppbroj","decl":"protected theorem one_mul : (1 : Submodule R A) * M = M "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\n| 1 * M","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => ","nextTactic":"rw [one_eq_span, ← span_eq M]","declUpToTactic":"protected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.223_0.IvhXmXo9kppbroj","decl":"protected theorem one_mul : (1 : Submodule R A) * M = M "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\n| 1 * M","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => ","nextTactic":"rw [one_eq_span, ← span_eq M]","declUpToTactic":"protected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.223_0.IvhXmXo9kppbroj","decl":"protected theorem one_mul : (1 : Submodule R A) * M = M "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\n⊢ span R {1} * span R ↑M = M","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n ","nextTactic":"erw [span_mul_span, one_mul, span_eq]","declUpToTactic":"protected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.223_0.IvhXmXo9kppbroj","decl":"protected theorem one_mul : (1 : Submodule R A) * M = M "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\n⊢ M * 1 = M","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n ","nextTactic":"conv_lhs => rw [one_eq_span, ← span_eq M]","declUpToTactic":"protected theorem mul_one : M * 1 = M := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.229_0.IvhXmXo9kppbroj","decl":"protected theorem mul_one : M * 1 = M "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\n| M * 1","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => ","nextTactic":"rw [one_eq_span, ← span_eq M]","declUpToTactic":"protected theorem mul_one : M * 1 = M := by\n conv_lhs => ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.229_0.IvhXmXo9kppbroj","decl":"protected theorem mul_one : M * 1 = M "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\n| M * 1","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => ","nextTactic":"rw [one_eq_span, ← span_eq M]","declUpToTactic":"protected theorem mul_one : M * 1 = M := by\n conv_lhs => ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.229_0.IvhXmXo9kppbroj","decl":"protected theorem mul_one : M * 1 = M "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\n| M * 1","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => ","nextTactic":"rw [one_eq_span, ← span_eq M]","declUpToTactic":"protected theorem mul_one : M * 1 = M := by\n conv_lhs => ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.229_0.IvhXmXo9kppbroj","decl":"protected theorem mul_one : M * 1 = M "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\n⊢ span R ↑M * span R {1} = M","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n ","nextTactic":"erw [span_mul_span, mul_one, span_eq]","declUpToTactic":"protected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.229_0.IvhXmXo9kppbroj","decl":"protected theorem mul_one : M * 1 = M "} +{"state":"ι : Sort uι\nR : Type u\ninst✝⁴ : CommSemiring R\nA : Type v\ninst✝³ : Semiring A\ninst✝² : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\nA' : Type u_1\ninst✝¹ : Semiring A'\ninst✝ : Algebra R A'\nf : A →ₐ[R] A'\n⊢ ⨆ i, map (AlgHom.toLinearMap f) (map ((LinearMap.mul R A) ↑i) N) =\n map (AlgHom.toLinearMap f) M * map (AlgHom.toLinearMap f) N","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n ","nextTactic":"apply congr_arg sSup","declUpToTactic":"protected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.263_0.IvhXmXo9kppbroj","decl":"protected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N "} +{"state":"ι : Sort uι\nR : Type u\ninst✝⁴ : CommSemiring R\nA : Type v\ninst✝³ : Semiring A\ninst✝² : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\nA' : Type u_1\ninst✝¹ : Semiring A'\ninst✝ : Algebra R A'\nf : A →ₐ[R] A'\n⊢ (range fun i => map (AlgHom.toLinearMap f) (map ((LinearMap.mul R A) ↑i) N)) =\n range fun s => map ((LinearMap.mul R A') ↑s) (map (AlgHom.toLinearMap f) N)","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ","nextTactic":"ext S","declUpToTactic":"protected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.263_0.IvhXmXo9kppbroj","decl":"protected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N "} +{"state":"case h\nι : Sort uι\nR : Type u\ninst✝⁴ : CommSemiring R\nA : Type v\ninst✝³ : Semiring A\ninst✝² : Algebra R A\nS✝ T : Set A\nM N P Q : Submodule R A\nm n : A\nA' : Type u_1\ninst✝¹ : Semiring A'\ninst✝ : Algebra R A'\nf : A →ₐ[R] A'\nS : Submodule R A'\n⊢ (S ∈ range fun i => map (AlgHom.toLinearMap f) (map ((LinearMap.mul R A) ↑i) N)) ↔\n S ∈ range fun s => map ((LinearMap.mul R A') ↑s) (map (AlgHom.toLinearMap f) N)","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n ","nextTactic":"constructor","declUpToTactic":"protected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.263_0.IvhXmXo9kppbroj","decl":"protected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N "} +{"state":"case h.mp\nι : Sort uι\nR : Type u\ninst✝⁴ : CommSemiring R\nA : Type v\ninst✝³ : Semiring A\ninst✝² : Algebra R A\nS✝ T : Set A\nM N P Q : Submodule R A\nm n : A\nA' : Type u_1\ninst✝¹ : Semiring A'\ninst✝ : Algebra R A'\nf : A →ₐ[R] A'\nS : Submodule R A'\n⊢ (S ∈ range fun i => map (AlgHom.toLinearMap f) (map ((LinearMap.mul R A) ↑i) N)) →\n S ∈ range fun s => map ((LinearMap.mul R A') ↑s) (map (AlgHom.toLinearMap f) N)","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> ","nextTactic":"rintro ⟨y, hy⟩","declUpToTactic":"protected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.263_0.IvhXmXo9kppbroj","decl":"protected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N "} +{"state":"case h.mpr\nι : Sort uι\nR : Type u\ninst✝⁴ : CommSemiring R\nA : Type v\ninst✝³ : Semiring A\ninst✝² : Algebra R A\nS✝ T : Set A\nM N P Q : Submodule R A\nm n : A\nA' : Type u_1\ninst✝¹ : Semiring A'\ninst✝ : Algebra R A'\nf : A →ₐ[R] A'\nS : Submodule R A'\n⊢ (S ∈ range fun s => map ((LinearMap.mul R A') ↑s) (map (AlgHom.toLinearMap f) N)) →\n S ∈ range fun i => map (AlgHom.toLinearMap f) (map ((LinearMap.mul R A) ↑i) N)","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy �� C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> ","nextTactic":"rintro ⟨y, hy⟩","declUpToTactic":"protected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.263_0.IvhXmXo9kppbroj","decl":"protected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N "} +{"state":"case h.mp.intro\nι : Sort uι\nR : Type u\ninst✝⁴ : CommSemiring R\nA : Type v\ninst✝³ : Semiring A\ninst✝² : Algebra R A\nS✝ T : Set A\nM N P Q : Submodule R A\nm n : A\nA' : Type u_1\ninst✝¹ : Semiring A'\ninst✝ : Algebra R A'\nf : A →ₐ[R] A'\nS : Submodule R A'\ny : ↥M\nhy : (fun i => map (AlgHom.toLinearMap f) (map ((LinearMap.mul R A) ↑i) N)) y = S\n⊢ S ∈ range fun s => map ((LinearMap.mul R A') ↑s) (map (AlgHom.toLinearMap f) N)","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · ","nextTactic":"use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩","declUpToTactic":"protected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.263_0.IvhXmXo9kppbroj","decl":"protected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N "} +{"state":"case h\nι : Sort uι\nR : Type u\ninst✝⁴ : CommSemiring R\nA : Type v\ninst✝³ : Semiring A\ninst✝² : Algebra R A\nS✝ T : Set A\nM N P Q : Submodule R A\nm n : A\nA' : Type u_1\ninst✝¹ : Semiring A'\ninst✝ : Algebra R A'\nf : A →ₐ[R] A'\nS : Submodule R A'\ny : ↥M\nhy : (fun i => map (AlgHom.toLinearMap f) (map ((LinearMap.mul R A) ↑i) N)) y = S\n⊢ (fun s => map ((LinearMap.mul R A') ↑s) (map (AlgHom.toLinearMap f) N))\n { val := f ↑y, property := (_ : f ↑y ∈ map (AlgHom.toLinearMap f) M) } =\n S","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n ","nextTactic":"refine' Eq.trans _ hy","declUpToTactic":"protected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.263_0.IvhXmXo9kppbroj","decl":"protected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N "} +{"state":"case h\nι : Sort uι\nR : Type u\ninst✝⁴ : CommSemiring R\nA : Type v\ninst✝³ : Semiring A\ninst✝² : Algebra R A\nS✝ T : Set A\nM N P Q : Submodule R A\nm n : A\nA' : Type u_1\ninst✝¹ : Semiring A'\ninst✝ : Algebra R A'\nf : A →ₐ[R] A'\nS : Submodule R A'\ny : ↥M\nhy : (fun i => map (AlgHom.toLinearMap f) (map ((LinearMap.mul R A) ↑i) N)) y = S\n⊢ (fun s => map ((LinearMap.mul R A') ↑s) (map (AlgHom.toLinearMap f) N))\n { val := f ↑y, property := (_ : f ↑y ∈ map (AlgHom.toLinearMap f) M) } =\n (fun i => map (AlgHom.toLinearMap f) (map ((LinearMap.mul R A) ↑i) N)) y","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ","nextTactic":"ext","declUpToTactic":"protected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.263_0.IvhXmXo9kppbroj","decl":"protected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N "} +{"state":"case h.h\nι : Sort uι\nR : Type u\ninst✝⁴ : CommSemiring R\nA : Type v\ninst✝³ : Semiring A\ninst✝² : Algebra R A\nS✝ T : Set A\nM N P Q : Submodule R A\nm n : A\nA' : Type u_1\ninst✝¹ : Semiring A'\ninst✝ : Algebra R A'\nf : A →ₐ[R] A'\nS : Submodule R A'\ny : ↥M\nhy : (fun i => map (AlgHom.toLinearMap f) (map ((LinearMap.mul R A) ↑i) N)) y = S\nx✝ : A'\n⊢ x✝ ∈\n (fun s => map ((LinearMap.mul R A') ↑s) (map (AlgHom.toLinearMap f) N))\n { val := f ↑y, property := (_ : f ↑y ∈ map (AlgHom.toLinearMap f) M) } ↔\n x✝ ∈ (fun i => map (AlgHom.toLinearMap f) (map ((LinearMap.mul R A) ↑i) N)) y","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n ","nextTactic":"simp","declUpToTactic":"protected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.263_0.IvhXmXo9kppbroj","decl":"protected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N "} +{"state":"case h.mpr.intro\nι : Sort uι\nR : Type u\ninst✝⁴ : CommSemiring R\nA : Type v\ninst✝³ : Semiring A\ninst✝² : Algebra R A\nS✝ T : Set A\nM N P Q : Submodule R A\nm n : A\nA' : Type u_1\ninst✝¹ : Semiring A'\ninst✝ : Algebra R A'\nf : A →ₐ[R] A'\nS : Submodule R A'\ny : ↥(map (AlgHom.toLinearMap f) M)\nhy : (fun s => map ((LinearMap.mul R A') ↑s) (map (AlgHom.toLinearMap f) N)) y = S\n⊢ S ∈ range fun i => map (AlgHom.toLinearMap f) (map ((LinearMap.mul R A) ↑i) N)","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · ","nextTactic":"obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2","declUpToTactic":"protected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.263_0.IvhXmXo9kppbroj","decl":"protected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N "} +{"state":"case h.mpr.intro.intro.intro\nι : Sort uι\nR : Type u\ninst✝⁴ : CommSemiring R\nA : Type v\ninst✝³ : Semiring A\ninst✝² : Algebra R A\nS✝ T : Set A\nM N P Q : Submodule R A\nm n : A\nA' : Type u_1\ninst✝¹ : Semiring A'\ninst✝ : Algebra R A'\nf : A →ₐ[R] A'\nS : Submodule R A'\ny : ↥(map (AlgHom.toLinearMap f) M)\nhy : (fun s => map ((LinearMap.mul R A') ↑s) (map (AlgHom.toLinearMap f) N)) y = S\ny' : A\nhy' : y' ∈ M\nfy_eq : (AlgHom.toLinearMap f) y' = ↑y\n⊢ S ∈ range fun i => map (AlgHom.toLinearMap f) (map ((LinearMap.mul R A) ↑i) N)","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n ","nextTactic":"use ⟨y', hy'⟩","declUpToTactic":"protected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.263_0.IvhXmXo9kppbroj","decl":"protected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N "} +{"state":"case h\nι : Sort uι\nR : Type u\ninst✝⁴ : CommSemiring R\nA : Type v\ninst✝³ : Semiring A\ninst✝² : Algebra R A\nS✝ T : Set A\nM N P Q : Submodule R A\nm n : A\nA' : Type u_1\ninst✝¹ : Semiring A'\ninst✝ : Algebra R A'\nf : A →ₐ[R] A'\nS : Submodule R A'\ny : ↥(map (AlgHom.toLinearMap f) M)\nhy : (fun s => map ((LinearMap.mul R A') ↑s) (map (AlgHom.toLinearMap f) N)) y = S\ny' : A\nhy' : y' ∈ M\nfy_eq : (AlgHom.toLinearMap f) y' = ↑y\n⊢ (fun i => map (AlgHom.toLinearMap f) (map ((LinearMap.mul R A) ↑i) N)) { val := y', property := hy' } = S","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map��� hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n ","nextTactic":"refine' Eq.trans _ hy","declUpToTactic":"protected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.263_0.IvhXmXo9kppbroj","decl":"protected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N "} +{"state":"case h\nι : Sort uι\nR : Type u\ninst✝⁴ : CommSemiring R\nA : Type v\ninst✝³ : Semiring A\ninst✝² : Algebra R A\nS✝ T : Set A\nM N P Q : Submodule R A\nm n : A\nA' : Type u_1\ninst✝¹ : Semiring A'\ninst✝ : Algebra R A'\nf : A →ₐ[R] A'\nS : Submodule R A'\ny : ↥(map (AlgHom.toLinearMap f) M)\nhy : (fun s => map ((LinearMap.mul R A') ↑s) (map (AlgHom.toLinearMap f) N)) y = S\ny' : A\nhy' : y' ∈ M\nfy_eq : (AlgHom.toLinearMap f) y' = ↑y\n⊢ (fun i => map (AlgHom.toLinearMap f) (map ((LinearMap.mul R A) ↑i) N)) { val := y', property := hy' } =\n (fun s => map ((LinearMap.mul R A') ↑s) (map (AlgHom.toLinearMap f) N)) y","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ","nextTactic":"rw [f.toLinearMap_apply] at fy_eq","declUpToTactic":"protected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.263_0.IvhXmXo9kppbroj","decl":"protected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N "} +{"state":"case h\nι : Sort uι\nR : Type u\ninst✝⁴ : CommSemiring R\nA : Type v\ninst✝³ : Semiring A\ninst✝² : Algebra R A\nS✝ T : Set A\nM N P Q : Submodule R A\nm n : A\nA' : Type u_1\ninst✝¹ : Semiring A'\ninst✝ : Algebra R A'\nf : A →ₐ[R] A'\nS : Submodule R A'\ny : ↥(map (AlgHom.toLinearMap f) M)\nhy : (fun s => map ((LinearMap.mul R A') ↑s) (map (AlgHom.toLinearMap f) N)) y = S\ny' : A\nhy' : y' ∈ M\nfy_eq : f y' = ↑y\n⊢ (fun i => map (AlgHom.toLinearMap f) (map ((LinearMap.mul R A) ↑i) N)) { val := y', property := hy' } =\n (fun s => map ((LinearMap.mul R A') ↑s) (map (AlgHom.toLinearMap f) N)) y","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ","nextTactic":"ext","declUpToTactic":"protected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.263_0.IvhXmXo9kppbroj","decl":"protected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N "} +{"state":"case h.h\nι : Sort uι\nR : Type u\ninst✝⁴ : CommSemiring R\nA : Type v\ninst✝³ : Semiring A\ninst✝² : Algebra R A\nS✝ T : Set A\nM N P Q : Submodule R A\nm n : A\nA' : Type u_1\ninst✝¹ : Semiring A'\ninst✝ : Algebra R A'\nf : A →ₐ[R] A'\nS : Submodule R A'\ny : ↥(map (AlgHom.toLinearMap f) M)\nhy : (fun s => map ((LinearMap.mul R A') ↑s) (map (AlgHom.toLinearMap f) N)) y = S\ny' : A\nhy' : y' ∈ M\nfy_eq : f y' = ↑y\nx✝ : A'\n⊢ x✝ ∈ (fun i => map (AlgHom.toLinearMap f) (map ((LinearMap.mul R A) ↑i) N)) { val := y', property := hy' } ↔\n x✝ ∈ (fun s => map ((LinearMap.mul R A') ↑s) (map (AlgHom.toLinearMap f) N)) y","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n ","nextTactic":"simp [fy_eq]","declUpToTactic":"protected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.263_0.IvhXmXo9kppbroj","decl":"protected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\n⊢ map (↑(opLinearEquiv R)) (M * N) = map (↑(opLinearEquiv R)) N * map (↑(opLinearEquiv R)) M","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n ","nextTactic":"apply le_antisymm","declUpToTactic":"theorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.284_0.IvhXmXo9kppbroj","decl":"theorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M "} +{"state":"case a\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\n⊢ map (↑(opLinearEquiv R)) (M * N) ≤ map (↑(opLinearEquiv R)) N * map (↑(opLinearEquiv R)) M","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · ","nextTactic":"simp_rw [map_le_iff_le_comap]","declUpToTactic":"theorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.284_0.IvhXmXo9kppbroj","decl":"theorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M "} +{"state":"case a\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\n⊢ M * N ≤ comap (↑(opLinearEquiv R)) (map (↑(opLinearEquiv R)) N * map (↑(opLinearEquiv R)) M)","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n ","nextTactic":"refine' mul_le.2 fun m hm n hn => _","declUpToTactic":"theorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.284_0.IvhXmXo9kppbroj","decl":"theorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M "} +{"state":"case a\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm✝ n✝ m : A\nhm : m ∈ M\nn : A\nhn : n ∈ N\n⊢ m * n ∈ comap (↑(opLinearEquiv R)) (map (↑(opLinearEquiv R)) N * map (↑(opLinearEquiv R)) M)","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n ","nextTactic":"rw [mem_comap]","declUpToTactic":"theorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.284_0.IvhXmXo9kppbroj","decl":"theorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M "} +{"state":"case a\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm✝ n✝ m : A\nhm : m ∈ M\nn : A\nhn : n ∈ N\n⊢ ↑(opLinearEquiv R) (m * n) ∈ map (↑(opLinearEquiv R)) N * map (↑(opLinearEquiv R)) M","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n ","nextTactic":"rw [map_equiv_eq_comap_symm]","declUpToTactic":"theorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (���(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.284_0.IvhXmXo9kppbroj","decl":"theorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M "} +{"state":"case a\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm✝ n✝ m : A\nhm : m ∈ M\nn : A\nhn : n ∈ N\n⊢ ↑(opLinearEquiv R) (m * n) ∈ comap (↑(LinearEquiv.symm (opLinearEquiv R))) N * map (↑(opLinearEquiv R)) M","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n ","nextTactic":"rw [map_equiv_eq_comap_symm]","declUpToTactic":"theorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.284_0.IvhXmXo9kppbroj","decl":"theorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M "} +{"state":"case a\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm✝ n✝ m : A\nhm : m ∈ M\nn : A\nhn : n ∈ N\n⊢ ↑(opLinearEquiv R) (m * n) ∈\n comap (↑(LinearEquiv.symm (opLinearEquiv R))) N * comap (↑(LinearEquiv.symm (opLinearEquiv R))) M","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n ","nextTactic":"show op n * op m ∈ _","declUpToTactic":"theorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.284_0.IvhXmXo9kppbroj","decl":"theorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M "} +{"state":"case a\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm✝ n✝ m : A\nhm : m ∈ M\nn : A\nhn : n ∈ N\n⊢ op n * op m ∈ comap (↑(LinearEquiv.symm (opLinearEquiv R))) N * comap (↑(LinearEquiv.symm (opLinearEquiv R))) M","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n ","nextTactic":"exact mul_mem_mul hn hm","declUpToTactic":"theorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.284_0.IvhXmXo9kppbroj","decl":"theorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M "} +{"state":"case a\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\n⊢ map (↑(opLinearEquiv R)) N * map (↑(opLinearEquiv R)) M ≤ map (↑(opLinearEquiv R)) (M * N)","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · ","nextTactic":"refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)","declUpToTactic":"theorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.284_0.IvhXmXo9kppbroj","decl":"theorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M "} +{"state":"case a\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm✝ n✝ m : A\nhm : op m ∈ map (↑(opLinearEquiv R)) N\nn : A\nhn : op n ∈ map (↑(opLinearEquiv R)) M\n⊢ op m * op n ∈ map (↑(opLinearEquiv R)) (M * N)","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n ","nextTactic":"rw [Submodule.mem_map_equiv] at hm hn ⊢","declUpToTactic":"theorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.284_0.IvhXmXo9kppbroj","decl":"theorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M "} +{"state":"case a\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm✝ n✝ m : A\nhm : (LinearEquiv.symm (opLinearEquiv R)) (op m) ∈ N\nn : A\nhn : (LinearEquiv.symm (opLinearEquiv R)) (op n) ∈ M\n⊢ (LinearEquiv.symm (opLinearEquiv R)) (op m * op n) ∈ M * N","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n ","nextTactic":"exact mul_mem_mul hn hm","declUpToTactic":"theorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.284_0.IvhXmXo9kppbroj","decl":"theorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\n⊢ comap (↑(LinearEquiv.symm (opLinearEquiv R))) (M * N) =\n comap (↑(LinearEquiv.symm (opLinearEquiv R))) N * comap (↑(LinearEquiv.symm (opLinearEquiv R))) M","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n ","nextTactic":"simp_rw [← map_equiv_eq_comap_symm, map_op_mul]","declUpToTactic":"theorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.301_0.IvhXmXo9kppbroj","decl":"theorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ ���ₗ[R] A) M "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM✝ N✝ P Q : Submodule R A\nm n : A\nM N : Submodule R Aᵐᵒᵖ\nthis : Function.Injective ⇑↑(opLinearEquiv R)\n⊢ map (↑(opLinearEquiv R)) (map (↑(LinearEquiv.symm (opLinearEquiv R))) (M * N)) =\n map (↑(opLinearEquiv R))\n (map (↑(LinearEquiv.symm (opLinearEquiv R))) N * map (↑(LinearEquiv.symm (opLinearEquiv R))) M)","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n ","nextTactic":"rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]","declUpToTactic":"theorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.308_0.IvhXmXo9kppbroj","decl":"theorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM✝ N✝ P Q : Submodule R A\nm n : A\nM N : Submodule R Aᵐᵒᵖ\n⊢ comap (↑(opLinearEquiv R)) (M * N) = comap (↑(opLinearEquiv R)) N * comap (↑(opLinearEquiv R)) M","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n ","nextTactic":"simp_rw [comap_equiv_eq_map_symm, map_unop_mul]","declUpToTactic":"theorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.319_0.IvhXmXo9kppbroj","decl":"theorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M "} +{"state":"ι : Sort uι\nR : Type u\ninst✝⁹ : CommSemiring R\nA✝ : Type v\ninst✝⁸ : Semiring A✝\ninst✝⁷ : Algebra R A✝\nS T : Set A✝\nM N P Q : Submodule R A✝\nm n : A✝\nA : Type u_1\nB : Type u_2\nC : Type u_3\ninst✝⁶ : CommSemiring A\ninst✝⁵ : CommSemiring B\ninst✝⁴ : Semiring C\ninst✝³ : Algebra A B\ninst✝² : Algebra A C\ninst✝¹ : Algebra B C\ninst✝ : IsScalarTower A B C\nI J : Submodule B C\n⊢ restrictScalars A (I * J) = restrictScalars A I * restrictScalars A J","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n ","nextTactic":"apply le_antisymm","declUpToTactic":"lemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.326_0.IvhXmXo9kppbroj","decl":"lemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A "} +{"state":"case a\nι : Sort uι\nR : Type u\ninst✝⁹ : CommSemiring R\nA✝ : Type v\ninst✝⁸ : Semiring A✝\ninst✝⁷ : Algebra R A✝\nS T : Set A✝\nM N P Q : Submodule R A✝\nm n : A✝\nA : Type u_1\nB : Type u_2\nC : Type u_3\ninst✝⁶ : CommSemiring A\ninst✝⁵ : CommSemiring B\ninst✝⁴ : Semiring C\ninst✝³ : Algebra A B\ninst✝² : Algebra A C\ninst✝¹ : Algebra B C\ninst✝ : IsScalarTower A B C\nI J : Submodule B C\n⊢ restrictScalars A (I * J) ≤ restrictScalars A I * restrictScalars A J","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · ","nextTactic":"intro x (hx : x ∈ I * J)","declUpToTactic":"lemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.326_0.IvhXmXo9kppbroj","decl":"lemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A "} +{"state":"case a\nι : Sort uι\nR : Type u\ninst✝⁹ : CommSemiring R\nA✝ : Type v\ninst✝⁸ : Semiring A✝\ninst✝⁷ : Algebra R A✝\nS T : Set A✝\nM N P Q : Submodule R A✝\nm n : A✝\nA : Type u_1\nB : Type u_2\nC : Type u_3\ninst✝⁶ : CommSemiring A\ninst✝⁵ : CommSemiring B\ninst✝⁴ : Semiring C\ninst✝³ : Algebra A B\ninst✝² : Algebra A C\ninst✝¹ : Algebra B C\ninst✝ : IsScalarTower A B C\nI J : Submodule B C\nx : C\nhx : x ∈ I * J\n⊢ x ∈ restrictScalars A I * restrictScalars A J","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n ","nextTactic":"refine Submodule.mul_induction_on hx ?_ ?_","declUpToTactic":"lemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.326_0.IvhXmXo9kppbroj","decl":"lemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A "} +{"state":"case a.refine_1\nι : Sort uι\nR : Type u\ninst✝⁹ : CommSemiring R\nA✝ : Type v\ninst✝⁸ : Semiring A✝\ninst✝⁷ : Algebra R A✝\nS T : Set A✝\nM N P Q : Submodule R A✝\nm n : A✝\nA : Type u_1\nB : Type u_2\nC : Type u_3\ninst✝⁶ : CommSemiring A\ninst✝⁵ : CommSemiring B\ninst✝⁴ : Semiring C\ninst✝³ : Algebra A B\ninst✝² : Algebra A C\ninst✝¹ : Algebra B C\ninst✝ : IsScalarTower A B C\nI J : Submodule B C\nx : C\nhx : x ∈ I * J\n⊢ ∀ m ∈ I, ∀ n ∈ J, m * n ∈ restrictScalars A I * restrictScalars A J","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · ","nextTactic":"exact fun m hm n hn ↦ mul_mem_mul hm hn","declUpToTactic":"lemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.326_0.IvhXmXo9kppbroj","decl":"lemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A "} +{"state":"case a.refine_2\nι : Sort uι\nR : Type u\ninst✝⁹ : CommSemiring R\nA✝ : Type v\ninst✝⁸ : Semiring A✝\ninst✝⁷ : Algebra R A✝\nS T : Set A✝\nM N P Q : Submodule R A✝\nm n : A✝\nA : Type u_1\nB : Type u_2\nC : Type u_3\ninst✝⁶ : CommSemiring A\ninst✝⁵ : CommSemiring B\ninst✝⁴ : Semiring C\ninst✝³ : Algebra A B\ninst✝² : Algebra A C\ninst✝¹ : Algebra B C\ninst✝ : IsScalarTower A B C\nI J : Submodule B C\nx : C\nhx : x ∈ I * J\n⊢ ∀ (x y : C),\n x ∈ restrictScalars A I * restrictScalars A J →\n y ∈ restrictScalars A I * restrictScalars A J → x + y ∈ restrictScalars A I * restrictScalars A J","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · ","nextTactic":"exact fun _ _ ↦ add_mem","declUpToTactic":"lemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.326_0.IvhXmXo9kppbroj","decl":"lemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A "} +{"state":"case a\nι : Sort uι\nR : Type u\ninst✝⁹ : CommSemiring R\nA✝ : Type v\ninst✝⁸ : Semiring A✝\ninst✝⁷ : Algebra R A✝\nS T : Set A✝\nM N P Q : Submodule R A✝\nm n : A✝\nA : Type u_1\nB : Type u_2\nC : Type u_3\ninst✝⁶ : CommSemiring A\ninst✝⁵ : CommSemiring B\ninst✝⁴ : Semiring C\ninst✝³ : Algebra A B\ninst✝² : Algebra A C\ninst✝¹ : Algebra B C\ninst✝ : IsScalarTower A B C\nI J : Submodule B C\n⊢ restrictScalars A I * restrictScalars A J ≤ restrictScalars A (I * J)","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · ","nextTactic":"exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)","declUpToTactic":"lemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.326_0.IvhXmXo9kppbroj","decl":"lemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A "} +{"state":"ι : Sort uι\nR✝ : Type u\ninst✝⁶ : CommSemiring R✝\nA✝ : Type v\ninst✝⁵ : Semiring A✝\ninst✝⁴ : Algebra R✝ A✝\nS✝ T : Set A✝\nM N P Q : Submodule R✝ A✝\nm n : A✝\nR : Type u_1\nA : Type u_2\ninst✝³ : Semiring R\ninst✝² : AddCommMonoid A\ninst✝¹ : Mul A\ninst✝ : Module R A\nS S' : Set A\nx : A\nhx : x ∈ span R (S * S')\n⊢ ∃ T T', ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (↑T * ↑T')","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n ","nextTactic":"obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx","declUpToTactic":"theorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.355_0.IvhXmXo9kppbroj","decl":"theorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) "} +{"state":"case intro.intro\nι : Sort uι\nR✝ : Type u\ninst✝⁶ : CommSemiring R✝\nA✝ : Type v\ninst✝⁵ : Semiring A✝\ninst✝⁴ : Algebra R✝ A✝\nS✝ T : Set A✝\nM N P Q : Submodule R✝ A✝\nm n : A✝\nR : Type u_1\nA : Type u_2\ninst✝³ : Semiring R\ninst✝² : AddCommMonoid A\ninst✝¹ : Mul A\ninst✝ : Module R A\nS S' : Set A\nx : A\nhx : x ∈ span R (S * S')\nU : Finset A\nh : ↑U ⊆ S * S'\nhU : x ∈ span R ↑U\n⊢ ∃ T T', ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (↑T * ↑T')","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl���\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n ","nextTactic":"obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h","declUpToTactic":"theorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.355_0.IvhXmXo9kppbroj","decl":"theorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) "} +{"state":"case intro.intro.intro.intro.intro.intro\nι : Sort uι\nR✝ : Type u\ninst✝⁶ : CommSemiring R✝\nA✝ : Type v\ninst✝⁵ : Semiring A✝\ninst✝⁴ : Algebra R✝ A✝\nS✝ T✝ : Set A✝\nM N P Q : Submodule R✝ A✝\nm n : A✝\nR : Type u_1\nA : Type u_2\ninst✝³ : Semiring R\ninst✝² : AddCommMonoid A\ninst✝¹ : Mul A\ninst✝ : Module R A\nS S' : Set A\nx : A\nhx : x ∈ span R (S * S')\nU : Finset A\nh✝ : ↑U ⊆ S * S'\nhU : x ∈ span R ↑U\nT T' : Finset A\nhS : ↑T ⊆ S\nhS' : ↑T' ⊆ S'\nh : U ⊆ T * T'\n⊢ ∃ T T', ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (↑T * ↑T')","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n ","nextTactic":"use T, T', hS, hS'","declUpToTactic":"theorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.355_0.IvhXmXo9kppbroj","decl":"theorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) "} +{"state":"case right\nι : Sort uι\nR✝ : Type u\ninst✝⁶ : CommSemiring R✝\nA✝ : Type v\ninst✝⁵ : Semiring A✝\ninst✝⁴ : Algebra R✝ A✝\nS✝ T✝ : Set A✝\nM N P Q : Submodule R✝ A✝\nm n : A✝\nR : Type u_1\nA : Type u_2\ninst✝³ : Semiring R\ninst✝² : AddCommMonoid A\ninst✝¹ : Mul A\ninst✝ : Module R A\nS S' : Set A\nx : A\nhx : x ∈ span R (S * S')\nU : Finset A\nh✝ : ↑U ⊆ S * S'\nhU : x ∈ span R ↑U\nT T' : Finset A\nhS : ↑T ⊆ S\nhS' : ↑T' ⊆ S'\nh : U ⊆ T * T'\n⊢ x ∈ span R (↑T * ↑T')","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n ","nextTactic":"have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast","declUpToTactic":"theorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.355_0.IvhXmXo9kppbroj","decl":"theorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) "} +{"state":"ι : Sort uι\nR✝ : Type u\ninst✝⁶ : CommSemiring R✝\nA✝ : Type v\ninst✝⁵ : Semiring A✝\ninst✝⁴ : Algebra R✝ A✝\nS✝ T✝ : Set A✝\nM N P Q : Submodule R✝ A✝\nm n : A✝\nR : Type u_1\nA : Type u_2\ninst✝³ : Semiring R\ninst✝² : AddCommMonoid A\ninst✝¹ : Mul A\ninst✝ : Module R A\nS S' : Set A\nx : A\nhx : x ∈ span R (S * S')\nU : Finset A\nh✝ : ↑U ⊆ S * S'\nhU : x ∈ span R ↑U\nT T' : Finset A\nhS : ↑T ⊆ S\nhS' : ↑T' ⊆ S'\nh : U ⊆ T * T'\n⊢ ↑U ⊆ ↑T * ↑T'","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by ","nextTactic":"assumption_mod_cast","declUpToTactic":"theorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.355_0.IvhXmXo9kppbroj","decl":"theorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) "} +{"state":"case right\nι : Sort uι\nR✝ : Type u\ninst✝⁶ : CommSemiring R✝\nA✝ : Type v\ninst✝⁵ : Semiring A✝\ninst✝⁴ : Algebra R✝ A✝\nS✝ T✝ : Set A✝\nM N P Q : Submodule R✝ A✝\nm n : A✝\nR : Type u_1\nA : Type u_2\ninst✝³ : Semiring R\ninst✝² : AddCommMonoid A\ninst✝¹ : Mul A\ninst✝ : Module R A\nS S' : Set A\nx : A\nhx : x ∈ span R (S * S')\nU : Finset A\nh✝ : ↑U ⊆ S * S'\nhU : x ∈ span R ↑U\nT T' : Finset A\nhS : ↑T ⊆ S\nhS' : ↑T' ⊆ S'\nh : U ⊆ T * T'\nh' : ↑U ⊆ ↑T * ↑T'\n⊢ x ∈ span R (↑T * ↑T')","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n ","nextTactic":"have h'' := span_mono h' hU","declUpToTactic":"theorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.355_0.IvhXmXo9kppbroj","decl":"theorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) "} +{"state":"case right\nι : Sort uι\nR✝ : Type u\ninst✝⁶ : CommSemiring R✝\nA✝ : Type v\ninst✝⁵ : Semiring A✝\ninst✝⁴ : Algebra R✝ A✝\nS✝ T✝ : Set A✝\nM N P Q : Submodule R✝ A✝\nm n : A✝\nR : Type u_1\nA : Type u_2\ninst✝³ : Semiring R\ninst✝² : AddCommMonoid A\ninst✝¹ : Mul A\ninst✝ : Module R A\nS S' : Set A\nx : A\nhx : x ∈ span R (S * S')\nU : Finset A\nh✝ : ↑U ⊆ S * S'\nhU : x ∈ span R ↑U\nT T' : Finset A\nhS : ↑T ⊆ S\nhS' : ↑T' ⊆ S'\nh : U ⊆ T * T'\nh' : ↑U ⊆ ↑T * ↑T'\nh'' : x ∈ span R (↑T * ↑T')\n⊢ x ∈ span R (↑T * ↑T')","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n ","nextTactic":"assumption","declUpToTactic":"theorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.355_0.IvhXmXo9kppbroj","decl":"theorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P✝ Q✝ : Submodule R A\nm n : A\nP Q : Submodule R A\nx : A\nhx : x ∈ P * Q\n⊢ x ∈ span R (↑P * ↑Q)","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by ","nextTactic":"rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx","declUpToTactic":"theorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.380_0.IvhXmXo9kppbroj","decl":"theorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n x y : A\n⊢ x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n ","nextTactic":"simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]","declUpToTactic":"theorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.388_0.IvhXmXo9kppbroj","decl":"theorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n x y : A\n⊢ x ∈ map ((LinearMap.mul R A) y) P ↔ ∃ z ∈ P, Mul.mul y z = x","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'��� -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n ","nextTactic":"rfl","declUpToTactic":"theorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.388_0.IvhXmXo9kppbroj","decl":"theorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n x y : A\n⊢ x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n ","nextTactic":"simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]","declUpToTactic":"theorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.394_0.IvhXmXo9kppbroj","decl":"theorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n x y : A\n⊢ x ∈ map ((LinearMap.flip (LinearMap.mul R A)) y) P ↔ ∃ z ∈ P, Mul.mul z y = x","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n ","nextTactic":"rfl","declUpToTactic":"theorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.394_0.IvhXmXo9kppbroj","decl":"theorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x "} +{"state":"ι : Sort uι\nR : Type u\ninst✝⁴ : CommSemiring R\nA : Type v\ninst✝³ : Semiring A\ninst✝² : Algebra R A\nS✝ T : Set A\nM N P Q : Submodule R A\nm n : A\nS : Type u_1\ninst✝¹ : Field S\ninst✝ : Algebra R S\nx : S\np : Submodule R S\ny : S\nhx : x ≠ 0\n⊢ y ∈ x • p ↔ x⁻¹ * y ∈ p","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n ","nextTactic":"constructor","declUpToTactic":"lemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.403_0.IvhXmXo9kppbroj","decl":"lemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p "} +{"state":"case mp\nι : Sort uι\nR : Type u\ninst✝⁴ : CommSemiring R\nA : Type v\ninst✝³ : Semiring A\ninst✝² : Algebra R A\nS✝ T : Set A\nM N P Q : Submodule R A\nm n : A\nS : Type u_1\ninst✝¹ : Field S\ninst✝ : Algebra R S\nx : S\np : Submodule R S\ny : S\nhx : x ≠ 0\n⊢ y ∈ x • p → x⁻¹ * y ∈ p","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · ","nextTactic":"rintro ⟨a, ha : a ∈ p, rfl⟩","declUpToTactic":"lemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.403_0.IvhXmXo9kppbroj","decl":"lemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p "} +{"state":"case mp.intro.intro\nι : Sort uι\nR : Type u\ninst✝⁴ : CommSemiring R\nA : Type v\ninst✝³ : Semiring A\ninst✝² : Algebra R A\nS✝ T : Set A\nM N P Q : Submodule R A\nm n : A\nS : Type u_1\ninst✝¹ : Field S\ninst✝ : Algebra R S\nx : S\np : Submodule R S\nhx : x ≠ 0\na : S\nha : a ∈ p\n⊢ x⁻¹ * (DistribMulAction.toLinearMap R S x) a ∈ p","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; ","nextTactic":"simpa [inv_mul_cancel_left₀ hx]","declUpToTactic":"lemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.403_0.IvhXmXo9kppbroj","decl":"lemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p "} +{"state":"case mpr\nι : Sort uι\nR : Type u\ninst✝⁴ : CommSemiring R\nA : Type v\ninst✝³ : Semiring A\ninst✝² : Algebra R A\nS✝ T : Set A\nM N P Q : Submodule R A\nm n : A\nS : Type u_1\ninst✝¹ : Field S\ninst✝ : Algebra R S\nx : S\np : Submodule R S\ny : S\nhx : x ≠ 0\n⊢ x⁻¹ * y ∈ p → y ∈ x • p","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · ","nextTactic":"exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩","declUpToTactic":"lemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.403_0.IvhXmXo9kppbroj","decl":"lemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p "} +{"state":"ι : Sort uι\nR : Type u\ninst✝⁴ : CommSemiring R\nA : Type v\ninst✝³ : Semiring A\ninst✝² : Algebra R A\nS✝ T : Set A\nM N P Q : Submodule R A\nm n : A\nS : Type u_1\ninst✝¹ : Field S\ninst✝ : Algebra R S\nx : S\np : Submodule R S\ny : S\nhx : x ≠ 0\nh : x⁻¹ * y ∈ p\n⊢ (DistribMulAction.toLinearMap R S x) (x⁻¹ * y) = y","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by ","nextTactic":"simp [mul_inv_cancel_left₀ hx]","declUpToTactic":"lemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.403_0.IvhXmXo9kppbroj","decl":"lemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p "} +{"state":"ι : Sort uι\nR : Type u\ninst✝⁴ : CommSemiring R\nA : Type v\ninst✝³ : Semiring A\ninst✝² : Algebra R A\nS✝ T : Set A\nM N P Q : Submodule R A\nm n : A\nS : Type u_1\ninst✝¹ : CommRing S\ninst✝ : Algebra R S\nx : S\np : Submodule R S\ny : S\nhx : x ∈ nonZeroDivisors S\n⊢ (∃ a ∈ ↑p, (DistribMulAction.toLinearMap R S x) a = x * y) ↔ y ∈ p","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by ","nextTactic":"simp [mul_cancel_left_mem_nonZeroDivisors hx]","declUpToTactic":"lemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.409_0.IvhXmXo9kppbroj","decl":"lemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\nsrc✝² : Semigroup (Submodule R A) :=\n Function.Injective.semigroup toAddSubmonoid (_ : Function.Injective toAddSubmonoid)\n (_ : ∀ (m n : Submodule R A), (m * n).toAddSubmonoid = m.toAddSubmonoid * n.toAddSubmonoid)\nsrc✝¹ : AddMonoidWithOne (Submodule R A) := AddMonoidWithOne.unary\nsrc✝ : AddCommMonoid (Submodule R A) := pointwiseAddCommMonoid\n⊢ Lattice (Submodule R A)","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by ","nextTactic":"infer_instance","declUpToTactic":"/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.414_0.IvhXmXo9kppbroj","decl":"/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\ns : Set A\n⊢ span R s ^ 0 = span R (s ^ 0)","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐ���ᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by ","nextTactic":"rw [pow_zero, pow_zero, one_eq_span_one_set]","declUpToTactic":"theorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.431_0.IvhXmXo9kppbroj","decl":"theorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]"} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n✝ : A\ns : Set A\nn : ℕ\n⊢ span R s ^ (n + 1) = span R (s ^ (n + 1))","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by ","nextTactic":"rw [pow_succ, pow_succ, span_pow s n, span_mul_span]","declUpToTactic":"theorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.431_0.IvhXmXo9kppbroj","decl":"theorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]"} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n✝ : A\nn : ℕ\n⊢ M ^ n = span R (↑M ^ n)","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n ","nextTactic":"rw [← span_pow]","declUpToTactic":"theorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.436_0.IvhXmXo9kppbroj","decl":"theorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n✝ : A\nn : ℕ\n⊢ M ^ n = span R ↑M ^ n","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n ","nextTactic":"rw [span_eq]","declUpToTactic":"theorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.436_0.IvhXmXo9kppbroj","decl":"theorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n✝ : A\nn : ℕ\nh : n ≠ 0\n⊢ (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n ","nextTactic":"induction' n with n ih","declUpToTactic":"theorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.449_0.IvhXmXo9kppbroj","decl":"theorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n "} +{"state":"case zero\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\nh : Nat.zero ≠ 0\n⊢ (M ^ Nat.zero).toAddSubmonoid = M.toAddSubmonoid ^ Nat.zero","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · ","nextTactic":"exact (h rfl).elim","declUpToTactic":"theorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.449_0.IvhXmXo9kppbroj","decl":"theorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n "} +{"state":"case succ\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n✝ : A\nn : ℕ\nih : n ≠ 0 → (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n\nh : Nat.succ n ≠ 0\n⊢ (M ^ Nat.succ n).toAddSubmonoid = M.toAddSubmonoid ^ Nat.succ n","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · ","nextTactic":"rw [pow_succ, pow_succ, mul_toAddSubmonoid]","declUpToTactic":"theorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.449_0.IvhXmXo9kppbroj","decl":"theorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n "} +{"state":"case succ\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n✝ : A\nn : ℕ\nih : n ≠ 0 → (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n\nh : Nat.succ n ≠ 0\n⊢ M.toAddSubmonoid * (M ^ n).toAddSubmonoid = M.toAddSubmonoid * M.toAddSubmonoid ^ n","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐ���ᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (���(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n ","nextTactic":"cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]","declUpToTactic":"theorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.449_0.IvhXmXo9kppbroj","decl":"theorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n "} +{"state":"case succ\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n✝ : A\nn : ℕ\nih : n ≠ 0 → (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n\nh : Nat.succ n ≠ 0\n⊢ M.toAddSubmonoid * (M ^ n).toAddSubmonoid = M.toAddSubmonoid * M.toAddSubmonoid ^ n","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n ","nextTactic":"cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]","declUpToTactic":"theorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.449_0.IvhXmXo9kppbroj","decl":"theorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n "} +{"state":"case succ.zero\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\nih : Nat.zero ≠ 0 → (M ^ Nat.zero).toAddSubmonoid = M.toAddSubmonoid ^ Nat.zero\nh : Nat.succ Nat.zero ≠ 0\n⊢ M.toAddSubmonoid * (M ^ Nat.zero).toAddSubmonoid = M.toAddSubmonoid * M.toAddSubmonoid ^ Nat.zero","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ��_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n ","nextTactic":"| zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]","declUpToTactic":"theorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.449_0.IvhXmXo9kppbroj","decl":"theorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n "} +{"state":"case succ.zero\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\nih : Nat.zero ≠ 0 → (M ^ Nat.zero).toAddSubmonoid = M.toAddSubmonoid ^ Nat.zero\nh : Nat.succ Nat.zero ≠ 0\n⊢ M.toAddSubmonoid * (M ^ Nat.zero).toAddSubmonoid = M.toAddSubmonoid * M.toAddSubmonoid ^ Nat.zero","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => ","nextTactic":"rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]","declUpToTactic":"theorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.449_0.IvhXmXo9kppbroj","decl":"theorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n "} +{"state":"case succ.succ\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n✝ : A\nn : ℕ\nih : Nat.succ n ≠ 0 → (M ^ Nat.succ n).toAddSubmonoid = M.toAddSubmonoid ^ Nat.succ n\nh : Nat.succ (Nat.succ n) ≠ 0\n⊢ M.toAddSubmonoid * (M ^ Nat.succ n).toAddSubmonoid = M.toAddSubmonoid * M.toAddSubmonoid ^ Nat.succ n","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n ","nextTactic":"| succ n => rw [ih n.succ_ne_zero]","declUpToTactic":"theorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.449_0.IvhXmXo9kppbroj","decl":"theorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n "} +{"state":"case succ.succ\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n✝ : A\nn : ℕ\nih : Nat.succ n ≠ 0 → (M ^ Nat.succ n).toAddSubmonoid = M.toAddSubmonoid ^ Nat.succ n\nh : Nat.succ (Nat.succ n) ≠ 0\n⊢ M.toAddSubmonoid * (M ^ Nat.succ n).toAddSubmonoid = M.toAddSubmonoid * M.toAddSubmonoid ^ Nat.succ n","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐ���ᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => ","nextTactic":"rw [ih n.succ_ne_zero]","declUpToTactic":"theorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.449_0.IvhXmXo9kppbroj","decl":"theorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n✝ : A\nn : ℕ\n⊢ M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n ","nextTactic":"obtain rfl | hn := Decidable.eq_or_ne n 0","declUpToTactic":"theorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.458_0.IvhXmXo9kppbroj","decl":"theorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid "} +{"state":"case inl\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\n⊢ M.toAddSubmonoid ^ 0 ≤ (M ^ 0).toAddSubmonoid","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · ","nextTactic":"rw [pow_zero, pow_zero]","declUpToTactic":"theorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.458_0.IvhXmXo9kppbroj","decl":"theorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid "} +{"state":"case inl\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\n⊢ 1 ≤ 1.toAddSubmonoid","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n ","nextTactic":"exact le_one_toAddSubmonoid","declUpToTactic":"theorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.458_0.IvhXmXo9kppbroj","decl":"theorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid "} +{"state":"case inr\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n✝ : A\nn : ℕ\nhn : n ≠ 0\n⊢ M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ���f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · ","nextTactic":"exact (pow_toAddSubmonoid M hn).ge","declUpToTactic":"theorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.458_0.IvhXmXo9kppbroj","decl":"theorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n✝ : A\nC : (n : ℕ) → (x : A) → x ∈ M ^ n → Prop\nhr : ∀ (r : R), C 0 ((algebraMap R A) r) (_ : (algebraMap R A) r ∈ 1)\nhadd : ∀ (x y : A) (i : ℕ) (hx : x ∈ M ^ i) (hy : y ∈ M ^ i), C i x hx → C i y hy → C i (x + y) (_ : x + y ∈ M ^ i)\nhmul :\n ∀ (m : A) (hm : m ∈ M) (i : ℕ) (x : A) (hx : x ∈ M ^ i),\n C i x hx → C (Nat.succ i) (m * x) (_ : m * x ∈ M * npowRec i M)\nn : ℕ\nx : A\nhx : x ∈ M ^ n\n⊢ C n x hx","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃��[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n ","nextTactic":"induction' n with n n_ih generalizing x","declUpToTactic":"/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.465_0.IvhXmXo9kppbroj","decl":"/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx "} +{"state":"case zero\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\nC : (n : ℕ) → (x : A) → x ∈ M ^ n → Prop\nhr : ∀ (r : R), C 0 ((algebraMap R A) r) (_ : (algebraMap R A) r ∈ 1)\nhadd : ∀ (x y : A) (i : ℕ) (hx : x ∈ M ^ i) (hy : y ∈ M ^ i), C i x hx → C i y hy → C i (x + y) (_ : x + y ∈ M ^ i)\nhmul :\n ∀ (m : A) (hm : m ∈ M) (i : ℕ) (x : A) (hx : x ∈ M ^ i),\n C i x hx → C (Nat.succ i) (m * x) (_ : m * x ∈ M * npowRec i M)\nx : A\nhx : x ∈ M ^ Nat.zero\n⊢ C Nat.zero x hx","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · ","nextTactic":"rw [pow_zero] at hx","declUpToTactic":"/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.465_0.IvhXmXo9kppbroj","decl":"/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx "} +{"state":"case zero\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\nC : (n : ℕ) → (x : A) → x ∈ M ^ n → Prop\nhr : ∀ (r : R), C 0 ((algebraMap R A) r) (_ : (algebraMap R A) r ∈ 1)\nhadd : ∀ (x y : A) (i : ℕ) (hx : x ∈ M ^ i) (hy : y ∈ M ^ i), C i x hx → C i y hy → C i (x + y) (_ : x + y ∈ M ^ i)\nhmul :\n ∀ (m : A) (hm : m ∈ M) (i : ℕ) (x : A) (hx : x ∈ M ^ i),\n C i x hx → C (Nat.succ i) (m * x) (_ : m * x ∈ M * npowRec i M)\nx : A\nhx✝ : x ∈ M ^ Nat.zero\nhx : x ∈ 1\n⊢ C Nat.zero x hx✝","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n ","nextTactic":"obtain ⟨r, rfl⟩ := hx","declUpToTactic":"/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.465_0.IvhXmXo9kppbroj","decl":"/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx "} +{"state":"case zero.intro\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\nC : (n : ℕ) → (x : A) → x ∈ M ^ n → Prop\nhr : ∀ (r : R), C 0 ((algebraMap R A) r) (_ : (algebraMap R A) r ∈ 1)\nhadd : ∀ (x y : A) (i : ℕ) (hx : x ∈ M ^ i) (hy : y ∈ M ^ i), C i x hx → C i y hy → C i (x + y) (_ : x + y ∈ M ^ i)\nhmul :\n ∀ (m : A) (hm : m ∈ M) (i : ℕ) (x : A) (hx : x ∈ M ^ i),\n C i x hx → C (Nat.succ i) (m * x) (_ : m * x ∈ M * npowRec i M)\nr : R\nhx : (Algebra.linearMap R A) r ∈ M ^ Nat.zero\n⊢ C Nat.zero ((Algebra.linearMap R A) r) hx","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n ","nextTactic":"exact hr r","declUpToTactic":"/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.465_0.IvhXmXo9kppbroj","decl":"/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx "} +{"state":"case succ\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n✝ : A\nC : (n : ℕ) → (x : A) → x ∈ M ^ n → Prop\nhr : ∀ (r : R), C 0 ((algebraMap R A) r) (_ : (algebraMap R A) r ∈ 1)\nhadd : ∀ (x y : A) (i : ℕ) (hx : x ∈ M ^ i) (hy : y ∈ M ^ i), C i x hx → C i y hy → C i (x + y) (_ : x + y ∈ M ^ i)\nhmul :\n ∀ (m : A) (hm : m ∈ M) (i : ℕ) (x : A) (hx : x ∈ M ^ i),\n C i x hx → C (Nat.succ i) (m * x) (_ : m * x ∈ M * npowRec i M)\nn : ℕ\nn_ih : ∀ {x : A} (hx : x ∈ M ^ n), C n x hx\nx : A\nhx : x ∈ M ^ Nat.succ n\n⊢ C (Nat.succ n) x hx","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n ","nextTactic":"exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx","declUpToTactic":"/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.465_0.IvhXmXo9kppbroj","decl":"/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n✝ : A\nC : (n : ℕ) → (x : A) → x ∈ M ^ n → Prop\nhr : ∀ (r : R), C 0 ((algebraMap R A) r) (_ : (algebraMap R A) r ∈ 1)\nhadd : ∀ (x y : A) (i : ℕ) (hx : x ∈ M ^ i) (hy : y ∈ M ^ i), C i x hx → C i y hy → C i (x + y) (_ : x + y ∈ M ^ i)\nhmul :\n ∀ (i : ℕ) (x : A) (hx : x ∈ M ^ i),\n C i x hx → ∀ (m : A) (hm : m ∈ M), C (Nat.succ i) (x * m) (_ : x * m ∈ M ^ (i + 1))\nn : ℕ\nx : A\nhx : x ∈ M ^ n\n⊢ C n x hx","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n ","nextTactic":"induction' n with n n_ih generalizing x","declUpToTactic":"/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.483_0.IvhXmXo9kppbroj","decl":"/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx "} +{"state":"case zero\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\nC : (n : ℕ) → (x : A) → x ∈ M ^ n → Prop\nhr : ∀ (r : R), C 0 ((algebraMap R A) r) (_ : (algebraMap R A) r ∈ 1)\nhadd : ∀ (x y : A) (i : ℕ) (hx : x ∈ M ^ i) (hy : y ∈ M ^ i), C i x hx → C i y hy → C i (x + y) (_ : x + y ∈ M ^ i)\nhmul :\n ∀ (i : ℕ) (x : A) (hx : x ∈ M ^ i),\n C i x hx → ∀ (m : A) (hm : m ∈ M), C (Nat.succ i) (x * m) (_ : x * m ∈ M ^ (i + 1))\nx : A\nhx : x ∈ M ^ Nat.zero\n⊢ C Nat.zero x hx","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · ","nextTactic":"rw [pow_zero] at hx","declUpToTactic":"/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.483_0.IvhXmXo9kppbroj","decl":"/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx "} +{"state":"case zero\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\nC : (n : ℕ) → (x : A) → x ∈ M ^ n → Prop\nhr : ∀ (r : R), C 0 ((algebraMap R A) r) (_ : (algebraMap R A) r ∈ 1)\nhadd : ∀ (x y : A) (i : ℕ) (hx : x ∈ M ^ i) (hy : y ∈ M ^ i), C i x hx → C i y hy → C i (x + y) (_ : x + y ∈ M ^ i)\nhmul :\n ∀ (i : ℕ) (x : A) (hx : x ∈ M ^ i),\n C i x hx → ∀ (m : A) (hm : m ∈ M), C (Nat.succ i) (x * m) (_ : x * m ∈ M ^ (i + 1))\nx : A\nhx✝ : x ∈ M ^ Nat.zero\nhx : x ∈ 1\n⊢ C Nat.zero x hx✝","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n ","nextTactic":"obtain ⟨r, rfl⟩ := hx","declUpToTactic":"/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.483_0.IvhXmXo9kppbroj","decl":"/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx "} +{"state":"case zero.intro\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\nC : (n : ℕ) → (x : A) → x ∈ M ^ n → Prop\nhr : ∀ (r : R), C 0 ((algebraMap R A) r) (_ : (algebraMap R A) r ∈ 1)\nhadd : ∀ (x y : A) (i : ℕ) (hx : x ∈ M ^ i) (hy : y ∈ M ^ i), C i x hx → C i y hy → C i (x + y) (_ : x + y ∈ M ^ i)\nhmul :\n ∀ (i : ℕ) (x : A) (hx : x ∈ M ^ i),\n C i x hx → ∀ (m : A) (hm : m ∈ M), C (Nat.succ i) (x * m) (_ : x * m ∈ M ^ (i + 1))\nr : R\nhx : (Algebra.linearMap R A) r ∈ M ^ Nat.zero\n⊢ C Nat.zero ((Algebra.linearMap R A) r) hx","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n ","nextTactic":"exact hr r","declUpToTactic":"/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.483_0.IvhXmXo9kppbroj","decl":"/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx "} +{"state":"case succ\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n✝ : A\nC : (n : ℕ) → (x : A) → x ∈ M ^ n → Prop\nhr : ∀ (r : R), C 0 ((algebraMap R A) r) (_ : (algebraMap R A) r ∈ 1)\nhadd : ∀ (x y : A) (i : ℕ) (hx : x ∈ M ^ i) (hy : y ∈ M ^ i), C i x hx → C i y hy → C i (x + y) (_ : x + y ∈ M ^ i)\nhmul :\n ∀ (i : ℕ) (x : A) (hx : x ∈ M ^ i),\n C i x hx → ∀ (m : A) (hm : m ∈ M), C (Nat.succ i) (x * m) (_ : x * m ∈ M ^ (i + 1))\nn : ℕ\nn_ih : ∀ {x : A} (hx : x ∈ M ^ n), C n x hx\nx : A\nhx : x ∈ M ^ Nat.succ n\n⊢ C (Nat.succ n) x hx","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →���[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n ","nextTactic":"revert hx","declUpToTactic":"/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.483_0.IvhXmXo9kppbroj","decl":"/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx "} +{"state":"case succ\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n✝ : A\nC : (n : ℕ) → (x : A) → x ∈ M ^ n → Prop\nhr : ∀ (r : R), C 0 ((algebraMap R A) r) (_ : (algebraMap R A) r ∈ 1)\nhadd : ∀ (x y : A) (i : ℕ) (hx : x ∈ M ^ i) (hy : y ∈ M ^ i), C i x hx → C i y hy → C i (x + y) (_ : x + y ∈ M ^ i)\nhmul :\n ∀ (i : ℕ) (x : A) (hx : x ∈ M ^ i),\n C i x hx → ∀ (m : A) (hm : m ∈ M), C (Nat.succ i) (x * m) (_ : x * m ∈ M ^ (i + 1))\nn : ℕ\nn_ih : ∀ {x : A} (hx : x ∈ M ^ n), C n x hx\nx : A\n⊢ ∀ (hx : x ∈ M ^ Nat.succ n), C (Nat.succ n) x hx","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * �� i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : �� r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n ","nextTactic":"simp_rw [pow_succ']","declUpToTactic":"/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.483_0.IvhXmXo9kppbroj","decl":"/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx "} +{"state":"case succ\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n✝ : A\nC : (n : ℕ) → (x : A) → x ∈ M ^ n → Prop\nhr : ∀ (r : R), C 0 ((algebraMap R A) r) (_ : (algebraMap R A) r ∈ 1)\nhadd : ∀ (x y : A) (i : ℕ) (hx : x ∈ M ^ i) (hy : y ∈ M ^ i), C i x hx → C i y hy → C i (x + y) (_ : x + y ∈ M ^ i)\nhmul :\n ∀ (i : ℕ) (x : A) (hx : x ∈ M ^ i),\n C i x hx → ∀ (m : A) (hm : m ∈ M), C (Nat.succ i) (x * m) (_ : x * m ∈ M ^ (i + 1))\nn : ℕ\nn_ih : ∀ {x : A} (hx : x ∈ M ^ n), C n x hx\nx : A\n⊢ ∀ (hx : x ∈ M ^ n * M), C (Nat.succ n) x (_ : x ∈ M ^ Nat.succ n)","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx�� ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n ","nextTactic":"intro hx","declUpToTactic":"/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.483_0.IvhXmXo9kppbroj","decl":"/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx "} +{"state":"case succ\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n✝ : A\nC : (n : ℕ) → (x : A) → x ∈ M ^ n → Prop\nhr : ∀ (r : R), C 0 ((algebraMap R A) r) (_ : (algebraMap R A) r ∈ 1)\nhadd : ∀ (x y : A) (i : ℕ) (hx : x ∈ M ^ i) (hy : y ∈ M ^ i), C i x hx → C i y hy → C i (x + y) (_ : x + y ∈ M ^ i)\nhmul :\n ∀ (i : ℕ) (x : A) (hx : x ∈ M ^ i),\n C i x hx → ∀ (m : A) (hm : m ∈ M), C (Nat.succ i) (x * m) (_ : x * m ∈ M ^ (i + 1))\nn : ℕ\nn_ih : ∀ {x : A} (hx : x ∈ M ^ n), C n x hx\nx : A\nhx : x ∈ M ^ n * M\n⊢ C (Nat.succ n) x (_ : x ∈ M ^ Nat.succ n)","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n ","nextTactic":"exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx","declUpToTactic":"/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.483_0.IvhXmXo9kppbroj","decl":"/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\np q : Submodule R Aᵐᵒᵖ\n⊢ Equiv.toFun\n { toFun := fun p => op (comap (↑(opLinearEquiv R)) p),\n invFun := fun p => comap (↑(LinearEquiv.symm (opLinearEquiv R))) (unop p),\n left_inv :=\n (_ :\n ∀ (p : Submodule R Aᵐᵒᵖ),\n (fun p => comap (↑(LinearEquiv.symm (opLinearEquiv R))) (unop p))\n ((fun p => op (comap (↑(opLinearEquiv R)) p)) p) =\n p),\n right_inv :=\n (_ :\n ∀ (p : (Submodule R A)ᵐᵒᵖ),\n (fun p => op (comap (↑(opLinearEquiv R)) p))\n ((fun p => comap (↑(LinearEquiv.symm (opLinearEquiv R))) (unop p)) p) =\n p) }\n (p + q) =\n Equiv.toFun\n { toFun := fun p => op (comap (↑(opLinearEquiv R)) p),\n invFun := fun p => comap (↑(LinearEquiv.symm (opLinearEquiv R))) (unop p),\n left_inv :=\n (_ :\n ∀ (p : Submodule R Aᵐᵒᵖ),\n (fun p => comap (↑(LinearEquiv.symm (opLinearEquiv R))) (unop p))\n ((fun p => op (comap (↑(opLinearEquiv R)) p)) p) =\n p),\n right_inv :=\n (_ :\n ∀ (p : (Submodule R A)ᵐᵒᵖ),\n (fun p => op (comap (↑(opLinearEquiv R)) p))\n ((fun p => comap (↑(LinearEquiv.symm (opLinearEquiv R))) (unop p)) p) =\n p) }\n p +\n Equiv.toFun\n { toFun := fun p => op (comap (↑(opLinearEquiv R)) p),\n invFun := fun p => comap (↑(LinearEquiv.symm (opLinearEquiv R))) (unop p),\n left_inv :=\n (_ :\n ∀ (p : Submodule R Aᵐᵒᵖ),\n (fun p => comap (↑(LinearEquiv.symm (opLinearEquiv R))) (unop p))\n ((fun p => op (comap (↑(opLinearEquiv R)) p)) p) =\n p),\n right_inv :=\n (_ :\n ∀ (p : (Submodule R A)ᵐᵒᵖ),\n (fun p => op (comap (↑(opLinearEquiv R)) p))\n ((fun p => comap (↑(LinearEquiv.symm (opLinearEquiv R))) (unop p)) p) =\n p) }\n q","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by ","nextTactic":"simp [comap_equiv_eq_map_symm, ← op_add]","declUpToTactic":"/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.538_0.IvhXmXo9kppbroj","decl":"/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n✝ : A\nn : ℕ\n⊢ map (↑(opLinearEquiv R)) (M ^ n) = map (↑(opLinearEquiv R)) M ^ n","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] A��ᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n ","nextTactic":"rw [map_equiv_eq_comap_symm]","declUpToTactic":"theorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.567_0.IvhXmXo9kppbroj","decl":"theorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n✝ : A\nn : ℕ\n⊢ comap (↑(LinearEquiv.symm (opLinearEquiv R))) (M ^ n) = map (↑(opLinearEquiv R)) M ^ n","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n ","nextTactic":"rw [map_equiv_eq_comap_symm]","declUpToTactic":"theorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.567_0.IvhXmXo9kppbroj","decl":"theorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n✝ : A\nn : ℕ\n⊢ comap (↑(LinearEquiv.symm (opLinearEquiv R))) (M ^ n) = comap (↑(LinearEquiv.symm (opLinearEquiv R))) M ^ n","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n ","nextTactic":"rw [comap_unop_pow]","declUpToTactic":"theorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.567_0.IvhXmXo9kppbroj","decl":"theorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM✝ N P Q : Submodule R A\nm n✝ : A\nn : ℕ\nM : Submodule R Aᵐᵒᵖ\n⊢ map (↑(LinearEquiv.symm (opLinearEquiv R))) (M ^ n) = map (↑(LinearEquiv.symm (opLinearEquiv R))) M ^ n","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n ","nextTactic":"rw [← comap_equiv_eq_map_symm]","declUpToTactic":"theorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.575_0.IvhXmXo9kppbroj","decl":"theorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM✝ N P Q : Submodule R A\nm n✝ : A\nn : ℕ\nM : Submodule R Aᵐᵒᵖ\n⊢ comap (↑(opLinearEquiv R)) (M ^ n) = map (↑(LinearEquiv.symm (opLinearEquiv R))) M ^ n","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n ","nextTactic":"rw [← comap_equiv_eq_map_symm]","declUpToTactic":"theorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.575_0.IvhXmXo9kppbroj","decl":"theorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM✝ N P Q : Submodule R A\nm n✝ : A\nn : ℕ\nM : Submodule R Aᵐᵒᵖ\n⊢ comap (↑(opLinearEquiv R)) (M ^ n) = comap (↑(opLinearEquiv R)) M ^ n","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [��� map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n ","nextTactic":"rw [comap_op_pow]","declUpToTactic":"theorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.575_0.IvhXmXo9kppbroj","decl":"theorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\ns t : SetSemiring A\n⊢ OneHom.toFun { toFun := fun s => span R (SetSemiring.down s), map_one' := (_ : span R {1} = 1) } (s * t) =\n OneHom.toFun { toFun := fun s => span R (SetSemiring.down s), map_one' := (_ : span R {1} = 1) } s *\n OneHom.toFun { toFun := fun s => span R (SetSemiring.down s), map_one' := (_ : span R {1} = 1) } t","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : A��ᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n ","nextTactic":"dsimp only","declUpToTactic":"/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.583_0.IvhXmXo9kppbroj","decl":"/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\ns t : SetSemiring A\n⊢ span R (SetSemiring.down (s * t)) = span R (SetSemiring.down s) * span R (SetSemiring.down t)","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n ","nextTactic":"rw [SetSemiring.down_mul]","declUpToTactic":"/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.583_0.IvhXmXo9kppbroj","decl":"/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : Semiring A\ninst✝ : Algebra R A\nS T : Set A\nM N P Q : Submodule R A\nm n : A\ns t : SetSemiring A\n⊢ span R (SetSemiring.down s * SetSemiring.down t) = span R (SetSemiring.down s) * span R (SetSemiring.down t)","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n ","nextTactic":"rw [span_mul_span]","declUpToTactic":"/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.583_0.IvhXmXo9kppbroj","decl":"/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s "} +{"state":"","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n ","nextTactic":"rw [← image_mul_prod]","declUpToTactic":"/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.583_0.IvhXmXo9kppbroj","decl":"/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s "} +{"state":"ι✝ : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM✝ N : Submodule R A\nm n : A\nι : Type u_1\ns : Finset ι\nM : ι → Set A\n⊢ ∏ i in s, span R (M i) = span R (∏ i in s, M i)","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n ","nextTactic":"letI := Classical.decEq ι","declUpToTactic":"theorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.641_0.IvhXmXo9kppbroj","decl":"theorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) "} +{"state":"ι✝ : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM✝ N : Submodule R A\nm n : A\nι : Type u_1\ns : Finset ι\nM : ι → Set A\nthis : DecidableEq ι := Classical.decEq ι\n⊢ ∏ i in s, span R (M i) = span R (∏ i in s, M i)","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ���ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n ","nextTactic":"refine' Finset.induction_on s _ _","declUpToTactic":"theorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.641_0.IvhXmXo9kppbroj","decl":"theorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) "} +{"state":"case refine'_1\nι✝ : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM✝ N : Submodule R A\nm n : A\nι : Type u_1\ns : Finset ι\nM : ι → Set A\nthis : DecidableEq ι := Classical.decEq ι\n⊢ ∏ i in ∅, span R (M i) = span R (∏ i in ∅, M i)","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · ","nextTactic":"simp [one_eq_span, Set.singleton_one]","declUpToTactic":"theorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.641_0.IvhXmXo9kppbroj","decl":"theorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) "} +{"state":"case refine'_2\nι✝ : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM✝ N : Submodule R A\nm n : A\nι : Type u_1\ns : Finset ι\nM : ι → Set A\nthis : DecidableEq ι := Classical.decEq ι\n⊢ ��� ⦃a : ι⦄ {s : Finset ι},\n a ∉ s →\n ∏ i in s, span R (M i) = span R (∏ i in s, M i) →\n ∏ i in insert a s, span R (M i) = span R (∏ i in insert a s, M i)","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · ","nextTactic":"intro _ _ H ih","declUpToTactic":"theorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.641_0.IvhXmXo9kppbroj","decl":"theorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) "} +{"state":"case refine'_2\nι✝ : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM✝ N : Submodule R A\nm n : A\nι : Type u_1\ns : Finset ι\nM : ι → Set A\nthis : DecidableEq ι := Classical.decEq ι\na✝ : ι\ns✝ : Finset ι\nH : a✝ ∉ s✝\nih : ∏ i in s✝, span R (M i) = span R (∏ i in s✝, M i)\n⊢ ∏ i in insert a✝ s✝, span R (M i) = span R (∏ i in insert a✝ s✝, M i)","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n ","nextTactic":"rw [Finset.prod_insert H]","declUpToTactic":"theorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.641_0.IvhXmXo9kppbroj","decl":"theorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) "} +{"state":"case refine'_2\nι✝ : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM✝ N : Submodule R A\nm n : A\nι : Type u_1\ns : Finset ι\nM : ι → Set A\nthis : DecidableEq ι := Classical.decEq ι\na✝ : ι\ns✝ : Finset ι\nH : a✝ ∉ s✝\nih : ∏ i in s✝, span R (M i) = span R (∏ i in s✝, M i)\n⊢ span R (M a✝) * ∏ x in s✝, span R (M x) = span R (∏ i in insert a✝ s✝, M i)","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n ","nextTactic":"rw [Finset.prod_insert H]","declUpToTactic":"theorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.641_0.IvhXmXo9kppbroj","decl":"theorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) "} +{"state":"case refine'_2\nι✝ : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM✝ N : Submodule R A\nm n : A\nι : Type u_1\ns : Finset ι\nM : ι → Set A\nthis : DecidableEq ι := Classical.decEq ι\na✝ : ι\ns✝ : Finset ι\nH : a✝ ∉ s✝\nih : ∏ i in s✝, span R (M i) = span R (∏ i in s✝, M i)\n⊢ span R (M a✝) * ∏ x in s✝, span R (M x) = span R (M a✝ * ∏ x in s✝, M x)","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n ","nextTactic":"rw [ih]","declUpToTactic":"theorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.641_0.IvhXmXo9kppbroj","decl":"theorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) "} +{"state":"case refine'_2\nι✝ : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM✝ N : Submodule R A\nm n : A\nι : Type u_1\ns : Finset ι\nM : ι → Set A\nthis : DecidableEq ι := Classical.decEq ι\na✝ : ι\ns✝ : Finset ι\nH : a✝ ∉ s✝\nih : ∏ i in s✝, span R (M i) = span R (∏ i in s✝, M i)\n⊢ span R (M a✝) * span R (∏ i in s✝, M i) = span R (M a✝ * ∏ x in s✝, M x)","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n ","nextTactic":"rw [span_mul_span]","declUpToTactic":"theorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.641_0.IvhXmXo9kppbroj","decl":"theorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) "} +{"state":"ι✝ : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM N : Submodule R A\nm n : A\nι : Type u_1\ns : Finset ι\nx : ι → A\n⊢ ∏ i in s, span R {x i} = span R {∏ i in s, x i}","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n ","nextTactic":"rw [prod_span]","declUpToTactic":"theorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.653_0.IvhXmXo9kppbroj","decl":"theorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} "} +{"state":"ι✝ : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM N : Submodule R A\nm n : A\nι : Type u_1\ns : Finset ι\nx : ι → A\n⊢ span R (∏ i in s, {x i}) = span R {∏ i in s, x i}","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n ","nextTactic":"rw [Set.finset_prod_singleton]","declUpToTactic":"theorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.653_0.IvhXmXo9kppbroj","decl":"theorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM N : Submodule R A\nm n : A\nP : Submodule R A\n⊢ 1 • P = P","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n ","nextTactic":"simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]","declUpToTactic":"/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.661_0.IvhXmXo9kppbroj","decl":"/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM N : Submodule R A\nm n : A\ns t : SetSemiring A\nP : Submodule R A\n⊢ (s * t) • P = s • t • P","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n ","nextTactic":"simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]","declUpToTactic":"/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.661_0.IvhXmXo9kppbroj","decl":"/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM N : Submodule R A\nm n : A\ns t : SetSemiring A\nP : Submodule R A\n⊢ (s + t) • P = s • P + t • P","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n ","nextTactic":"simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]","declUpToTactic":"/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.661_0.IvhXmXo9kppbroj","decl":"/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM N : Submodule R A\nm n : A\nP : Submodule R A\n⊢ 0 • P = 0","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n ","nextTactic":"simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]","declUpToTactic":"/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.661_0.IvhXmXo9kppbroj","decl":"/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM✝ N : Submodule R A\nm n a : A\nM : Submodule R A\n⊢ Set.up {a} • M = map (LinearMap.mulLeft R a) M","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n ","nextTactic":"conv_lhs => rw [← span_eq M]","declUpToTactic":"theorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.690_0.IvhXmXo9kppbroj","decl":"theorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM✝ N : Submodule R A\nm n a : A\nM : Submodule R A\n| Set.up {a} • M","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => ","nextTactic":"rw [← span_eq M]","declUpToTactic":"theorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.690_0.IvhXmXo9kppbroj","decl":"theorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM✝ N : Submodule R A\nm n a : A\nM : Submodule R A\n| Set.up {a} • M","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => ","nextTactic":"rw [← span_eq M]","declUpToTactic":"theorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.690_0.IvhXmXo9kppbroj","decl":"theorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM✝ N : Submodule R A\nm n a : A\nM : Submodule R A\n| Set.up {a} • M","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => ","nextTactic":"rw [← span_eq M]","declUpToTactic":"theorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.690_0.IvhXmXo9kppbroj","decl":"theorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM✝ N : Submodule R A\nm n a : A\nM : Submodule R A\n⊢ Set.up {a} • span R ↑M = map (LinearMap.mulLeft R a) M","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n �� rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n ","nextTactic":"change span _ _ * span _ _ = _","declUpToTactic":"theorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.690_0.IvhXmXo9kppbroj","decl":"theorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM✝ N : Submodule R A\nm n a : A\nM : Submodule R A\n⊢ span R (SetSemiring.down (Set.up {a})) * span R ↑M = map (LinearMap.mulLeft R a) M","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n ","nextTactic":"rw [span_mul_span]","declUpToTactic":"theorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.690_0.IvhXmXo9kppbroj","decl":"theorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM✝ N : Submodule R A\nm n a : A\nM : Submodule R A\n⊢ span R (SetSemiring.down (Set.up {a}) * ↑M) = map (LinearMap.mulLeft R a) M","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n ","nextTactic":"apply le_antisymm","declUpToTactic":"theorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.690_0.IvhXmXo9kppbroj","decl":"theorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) "} +{"state":"case a\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM✝ N : Submodule R A\nm n a : A\nM : Submodule R A\n⊢ span R (SetSemiring.down (Set.up {a}) * ↑M) ≤ map (LinearMap.mulLeft R a) M","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃���[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n �� obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · ","nextTactic":"rw [span_le]","declUpToTactic":"theorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.690_0.IvhXmXo9kppbroj","decl":"theorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) "} +{"state":"case a\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM✝ N : Submodule R A\nm n a : A\nM : Submodule R A\n⊢ SetSemiring.down (Set.up {a}) * ↑M ⊆ ↑(map (LinearMap.mulLeft R a) M)","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n ","nextTactic":"rintro _ ⟨b, m, hb, hm, rfl⟩","declUpToTactic":"theorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.690_0.IvhXmXo9kppbroj","decl":"theorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) "} +{"state":"case a.intro.intro.intro.intro\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM✝ N : Submodule R A\nm✝ n a : A\nM : Submodule R A\nb m : A\nhb : b ∈ SetSemiring.down (Set.up {a})\nhm : m ∈ ↑M\n⊢ (fun x x_1 => x * x_1) b m ∈ ↑(map (LinearMap.mulLeft R a) M)","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n ","nextTactic":"rw [SetLike.mem_coe]","declUpToTactic":"theorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.690_0.IvhXmXo9kppbroj","decl":"theorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) "} +{"state":"case a.intro.intro.intro.intro\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM✝ N : Submodule R A\nm✝ n a : A\nM : Submodule R A\nb m : A\nhb : b ∈ SetSemiring.down (Set.up {a})\nhm : m ∈ ↑M\n⊢ (fun x x_1 => x * x_1) b m ∈ map (LinearMap.mulLeft R a) M","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x �� p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n ","nextTactic":"rw [mem_map]","declUpToTactic":"theorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.690_0.IvhXmXo9kppbroj","decl":"theorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) "} +{"state":"case a.intro.intro.intro.intro\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM✝ N : Submodule R A\nm✝ n a : A\nM : Submodule R A\nb m : A\nhb : b ∈ SetSemiring.down (Set.up {a})\nhm : m ∈ ↑M\n⊢ ∃ y ∈ M, (LinearMap.mulLeft R a) y = (fun x x_1 => x * x_1) b m","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n ","nextTactic":"rw [Set.mem_singleton_iff.mp hb]","declUpToTactic":"theorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.690_0.IvhXmXo9kppbroj","decl":"theorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) "} +{"state":"case a.intro.intro.intro.intro\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM✝ N : Submodule R A\nm✝ n a : A\nM : Submodule R A\nb m : A\nhb : b ∈ SetSemiring.down (Set.up {a})\nhm : m ∈ ↑M\n⊢ ∃ y ∈ M, (LinearMap.mulLeft R a) y = (fun x x_1 => x * x_1) a m","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n ","nextTactic":"exact ⟨m, hm, rfl⟩","declUpToTactic":"theorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.690_0.IvhXmXo9kppbroj","decl":"theorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) "} +{"state":"case a\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM✝ N : Submodule R A\nm n a : A\nM : Submodule R A\n⊢ map (LinearMap.mulLeft R a) M ≤ span R (SetSemiring.down (Set.up {a}) * ↑M)","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r �� M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · ","nextTactic":"rintro _ ⟨m, hm, rfl⟩","declUpToTactic":"theorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.690_0.IvhXmXo9kppbroj","decl":"theorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) "} +{"state":"case a.intro.intro\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM✝ N : Submodule R A\nm✝ n a : A\nM : Submodule R A\nm : A\nhm : m ∈ ↑M\n⊢ (LinearMap.mulLeft R a) m ∈ span R (SetSemiring.down (Set.up {a}) * ↑M)","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n ","nextTactic":"exact subset_span ⟨a, m, Set.mem_singleton a, hm, rfl⟩","declUpToTactic":"theorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.690_0.IvhXmXo9kppbroj","decl":"theorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM N : Submodule R A\nm n : A\nI J : Submodule R A\na✝ b✝ : A\nha : a✝ ∈ {x | ∀ y ∈ J, x * y ∈ I}\nhb : b✝ ∈ {x | ∀ y ∈ J, x * y ∈ I}\ny : A\nhy : y ∈ J\n⊢ (a✝ + b✝) * y ∈ I","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n exact subset_span ⟨a, m, Set.mem_singleton a, hm, rfl⟩\n#align submodule.smul_singleton Submodule.smul_singleton\n\nsection Quotient\n\n/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n ","nextTactic":"rw [add_mul]","declUpToTactic":"/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.708_0.IvhXmXo9kppbroj","decl":"/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM N : Submodule R A\nm n : A\nI J : Submodule R A\na✝ b✝ : A\nha : a✝ ∈ {x | ∀ y ∈ J, x * y ∈ I}\nhb : b✝ ∈ {x | ∀ y ∈ J, x * y ∈ I}\ny : A\nhy : y ∈ J\n⊢ a✝ * y + b✝ * y ∈ I","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n exact subset_span ⟨a, m, Set.mem_singleton a, hm, rfl⟩\n#align submodule.smul_singleton Submodule.smul_singleton\n\nsection Quotient\n\n/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n rw [add_mul]\n ","nextTactic":"exact Submodule.add_mem _ (ha _ hy) (hb _ hy)","declUpToTactic":"/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n rw [add_mul]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.708_0.IvhXmXo9kppbroj","decl":"/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM N : Submodule R A\nm n : A\nI J : Submodule R A\ny : A\nx✝ : y ∈ J\n⊢ 0 * y ∈ I","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n exact subset_span ⟨a, m, Set.mem_singleton a, hm, rfl⟩\n#align submodule.smul_singleton Submodule.smul_singleton\n\nsection Quotient\n\n/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n ","nextTactic":"rw [zero_mul]","declUpToTactic":"/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.708_0.IvhXmXo9kppbroj","decl":"/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM N : Submodule R A\nm n : A\nI J : Submodule R A\ny : A\nx✝ : y ∈ J\n⊢ 0 ∈ I","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n exact subset_span ⟨a, m, Set.mem_singleton a, hm, rfl⟩\n#align submodule.smul_singleton Submodule.smul_singleton\n\nsection Quotient\n\n/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n ","nextTactic":"apply Submodule.zero_mem","declUpToTactic":"/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.708_0.IvhXmXo9kppbroj","decl":"/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM N : Submodule R A\nm n : A\nI J : Submodule R A\nr : R\nx : A\nhx :\n x ∈\n {\n toAddSubsemigroup :=\n { carrier := {x | ∀ y ∈ J, x * y ∈ I},\n add_mem' :=\n (_ :\n ∀ {a b : A},\n a ∈ {x | ∀ y ∈ J, x * y ∈ I} → b ∈ {x | ∀ y ∈ J, x * y ∈ I} → ∀ y ∈ J, (a + b) * y ∈ I) },\n zero_mem' := (_ : ∀ y ∈ J, 0 * y ∈ I) }.toAddSubsemigroup.carrier\ny : A\nhy : y ∈ J\n⊢ r • x * y ∈ I","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n exact subset_span ⟨a, m, Set.mem_singleton a, hm, rfl⟩\n#align submodule.smul_singleton Submodule.smul_singleton\n\nsection Quotient\n\n/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n rw [add_mul]\n exact Submodule.add_mem _ (ha _ hy) (hb _ hy)\n smul_mem' := fun r x hx y hy => by\n ","nextTactic":"rw [Algebra.smul_mul_assoc]","declUpToTactic":"/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n rw [add_mul]\n exact Submodule.add_mem _ (ha _ hy) (hb _ hy)\n smul_mem' := fun r x hx y hy => by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.708_0.IvhXmXo9kppbroj","decl":"/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM N : Submodule R A\nm n : A\nI J : Submodule R A\nr : R\nx : A\nhx :\n x ∈\n {\n toAddSubsemigroup :=\n { carrier := {x | ∀ y ∈ J, x * y ∈ I},\n add_mem' :=\n (_ :\n ∀ {a b : A},\n a ∈ {x | ∀ y ∈ J, x * y ∈ I} → b ∈ {x | ∀ y ∈ J, x * y ∈ I} → ∀ y ∈ J, (a + b) * y ∈ I) },\n zero_mem' := (_ : ∀ y ∈ J, 0 * y ∈ I) }.toAddSubsemigroup.carrier\ny : A\nhy : y ∈ J\n⊢ r • (x * y) ∈ I","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n exact subset_span ⟨a, m, Set.mem_singleton a, hm, rfl⟩\n#align submodule.smul_singleton Submodule.smul_singleton\n\nsection Quotient\n\n/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n rw [add_mul]\n exact Submodule.add_mem _ (ha _ hy) (hb _ hy)\n smul_mem' := fun r x hx y hy => by\n rw [Algebra.smul_mul_assoc]\n ","nextTactic":"exact Submodule.smul_mem _ _ (hx _ hy)","declUpToTactic":"/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n rw [add_mul]\n exact Submodule.add_mem _ (ha _ hy) (hb _ hy)\n smul_mem' := fun r x hx y hy => by\n rw [Algebra.smul_mul_assoc]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.708_0.IvhXmXo9kppbroj","decl":"/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM N : Submodule R A\nm n x : A\nI J : Submodule R A\nh : x ∈ I / J\ny : A\nx✝ : y ∈ x • ↑J\ny' : A\nhy' : y' ∈ ↑J\nxy'_eq_y : (fun x_1 => x • x_1) y' = y\n⊢ y ∈ ↑I","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n exact subset_span ⟨a, m, Set.mem_singleton a, hm, rfl⟩\n#align submodule.smul_singleton Submodule.smul_singleton\n\nsection Quotient\n\n/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n rw [add_mul]\n exact Submodule.add_mem _ (ha _ hy) (hb _ hy)\n smul_mem' := fun r x hx y hy => by\n rw [Algebra.smul_mul_assoc]\n exact Submodule.smul_mem _ _ (hx _ hy) }⟩\n\ntheorem mem_div_iff_forall_mul_mem {x : A} {I J : Submodule R A} : x ∈ I / J ↔ ∀ y ∈ J, x * y ∈ I :=\n Iff.refl _\n#align submodule.mem_div_iff_forall_mul_mem Submodule.mem_div_iff_forall_mul_mem\n\ntheorem mem_div_iff_smul_subset {x : A} {I J : Submodule R A} : x ∈ I / J ↔ x • (J : Set A) ⊆ I :=\n ⟨fun h y ⟨y', hy', xy'_eq_y⟩ => by\n ","nextTactic":"rw [← xy'_eq_y]","declUpToTactic":"theorem mem_div_iff_smul_subset {x : A} {I J : Submodule R A} : x ∈ I / J ↔ x • (J : Set A) ⊆ I :=\n ⟨fun h y ⟨y', hy', xy'_eq_y⟩ => by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.732_0.IvhXmXo9kppbroj","decl":"theorem mem_div_iff_smul_subset {x : A} {I J : Submodule R A} : x ∈ I / J ↔ x • (J : Set A) ⊆ I "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM N : Submodule R A\nm n x : A\nI J : Submodule R A\nh : x ∈ I / J\ny : A\nx✝ : y ∈ x • ↑J\ny' : A\nhy' : y' ∈ ↑J\nxy'_eq_y : (fun x_1 => x • x_1) y' = y\n⊢ (fun x_1 => x • x_1) y' ∈ ↑I","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n exact subset_span ⟨a, m, Set.mem_singleton a, hm, rfl⟩\n#align submodule.smul_singleton Submodule.smul_singleton\n\nsection Quotient\n\n/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n rw [add_mul]\n exact Submodule.add_mem _ (ha _ hy) (hb _ hy)\n smul_mem' := fun r x hx y hy => by\n rw [Algebra.smul_mul_assoc]\n exact Submodule.smul_mem _ _ (hx _ hy) }⟩\n\ntheorem mem_div_iff_forall_mul_mem {x : A} {I J : Submodule R A} : x ∈ I / J ↔ ∀ y ∈ J, x * y ∈ I :=\n Iff.refl _\n#align submodule.mem_div_iff_forall_mul_mem Submodule.mem_div_iff_forall_mul_mem\n\ntheorem mem_div_iff_smul_subset {x : A} {I J : Submodule R A} : x ∈ I / J ↔ x • (J : Set A) ⊆ I :=\n ⟨fun h y ⟨y', hy', xy'_eq_y⟩ => by\n rw [← xy'_eq_y]\n ","nextTactic":"apply h","declUpToTactic":"theorem mem_div_iff_smul_subset {x : A} {I J : Submodule R A} : x ∈ I / J ↔ x • (J : Set A) ⊆ I :=\n ⟨fun h y ⟨y', hy', xy'_eq_y⟩ => by\n rw [← xy'_eq_y]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.732_0.IvhXmXo9kppbroj","decl":"theorem mem_div_iff_smul_subset {x : A} {I J : Submodule R A} : x ∈ I / J ↔ x • (J : Set A) ⊆ I "} +{"state":"case a\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM N : Submodule R A\nm n x : A\nI J : Submodule R A\nh : x ∈ I / J\ny : A\nx✝ : y ∈ x • ↑J\ny' : A\nhy' : y' ∈ ↑J\nxy'_eq_y : (fun x_1 => x • x_1) y' = y\n⊢ y' ∈ J","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : �� r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒ��� ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n exact subset_span ⟨a, m, Set.mem_singleton a, hm, rfl⟩\n#align submodule.smul_singleton Submodule.smul_singleton\n\nsection Quotient\n\n/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n rw [add_mul]\n exact Submodule.add_mem _ (ha _ hy) (hb _ hy)\n smul_mem' := fun r x hx y hy => by\n rw [Algebra.smul_mul_assoc]\n exact Submodule.smul_mem _ _ (hx _ hy) }⟩\n\ntheorem mem_div_iff_forall_mul_mem {x : A} {I J : Submodule R A} : x ∈ I / J ↔ ∀ y ∈ J, x * y ∈ I :=\n Iff.refl _\n#align submodule.mem_div_iff_forall_mul_mem Submodule.mem_div_iff_forall_mul_mem\n\ntheorem mem_div_iff_smul_subset {x : A} {I J : Submodule R A} : x ∈ I / J ↔ x • (J : Set A) ⊆ I :=\n ⟨fun h y ⟨y', hy', xy'_eq_y⟩ => by\n rw [← xy'_eq_y]\n apply h\n ","nextTactic":"assumption","declUpToTactic":"theorem mem_div_iff_smul_subset {x : A} {I J : Submodule R A} : x ∈ I / J ↔ x • (J : Set A) ⊆ I :=\n ⟨fun h y ⟨y', hy', xy'_eq_y⟩ => by\n rw [← xy'_eq_y]\n apply h\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.732_0.IvhXmXo9kppbroj","decl":"theorem mem_div_iff_smul_subset {x : A} {I J : Submodule R A} : x ∈ I / J ↔ x • (J : Set A) ⊆ I "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM N : Submodule R A\nm n : A\nI J K : Submodule R A\n⊢ I ≤ J / K ↔ I * K ≤ J","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn �� mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n exact subset_span ⟨a, m, Set.mem_singleton a, hm, rfl⟩\n#align submodule.smul_singleton Submodule.smul_singleton\n\nsection Quotient\n\n/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n rw [add_mul]\n exact Submodule.add_mem _ (ha _ hy) (hb _ hy)\n smul_mem' := fun r x hx y hy => by\n rw [Algebra.smul_mul_assoc]\n exact Submodule.smul_mem _ _ (hx _ hy) }⟩\n\ntheorem mem_div_iff_forall_mul_mem {x : A} {I J : Submodule R A} : x ∈ I / J ↔ ∀ y ∈ J, x * y ∈ I :=\n Iff.refl _\n#align submodule.mem_div_iff_forall_mul_mem Submodule.mem_div_iff_forall_mul_mem\n\ntheorem mem_div_iff_smul_subset {x : A} {I J : Submodule R A} : x ∈ I / J ↔ x • (J : Set A) ⊆ I :=\n ⟨fun h y ⟨y', hy', xy'_eq_y⟩ => by\n rw [← xy'_eq_y]\n apply h\n assumption, fun h y hy => h (Set.smul_mem_smul_set hy)⟩\n#align submodule.mem_div_iff_smul_subset Submodule.mem_div_iff_smul_subset\n\ntheorem le_div_iff {I J K : Submodule R A} : I ≤ J / K ↔ ∀ x ∈ I, ∀ z ∈ K, x * z ∈ J :=\n Iff.refl _\n#align submodule.le_div_iff Submodule.le_div_iff\n\ntheorem le_div_iff_mul_le {I J K : Submodule R A} : I ≤ J / K ↔ I * K ≤ J := by\n ","nextTactic":"rw [le_div_iff]","declUpToTactic":"theorem le_div_iff_mul_le {I J K : Submodule R A} : I ≤ J / K ↔ I * K ≤ J := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.743_0.IvhXmXo9kppbroj","decl":"theorem le_div_iff_mul_le {I J K : Submodule R A} : I ≤ J / K ↔ I * K ≤ J "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM N : Submodule R A\nm n : A\nI J K : Submodule R A\n⊢ (∀ x ∈ I, ∀ z ∈ K, x * z ∈ J) ↔ I * K ≤ J","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n exact subset_span ⟨a, m, Set.mem_singleton a, hm, rfl⟩\n#align submodule.smul_singleton Submodule.smul_singleton\n\nsection Quotient\n\n/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n rw [add_mul]\n exact Submodule.add_mem _ (ha _ hy) (hb _ hy)\n smul_mem' := fun r x hx y hy => by\n rw [Algebra.smul_mul_assoc]\n exact Submodule.smul_mem _ _ (hx _ hy) }⟩\n\ntheorem mem_div_iff_forall_mul_mem {x : A} {I J : Submodule R A} : x ∈ I / J ↔ ∀ y ∈ J, x * y ∈ I :=\n Iff.refl _\n#align submodule.mem_div_iff_forall_mul_mem Submodule.mem_div_iff_forall_mul_mem\n\ntheorem mem_div_iff_smul_subset {x : A} {I J : Submodule R A} : x ∈ I / J ↔ x • (J : Set A) ⊆ I :=\n ⟨fun h y ⟨y', hy', xy'_eq_y⟩ => by\n rw [← xy'_eq_y]\n apply h\n assumption, fun h y hy => h (Set.smul_mem_smul_set hy)⟩\n#align submodule.mem_div_iff_smul_subset Submodule.mem_div_iff_smul_subset\n\ntheorem le_div_iff {I J K : Submodule R A} : I ≤ J / K ↔ ∀ x ∈ I, ∀ z ∈ K, x * z ∈ J :=\n Iff.refl _\n#align submodule.le_div_iff Submodule.le_div_iff\n\ntheorem le_div_iff_mul_le {I J K : Submodule R A} : I ≤ J / K ↔ I * K ≤ J := by\n rw [le_div_iff]\n ","nextTactic":"rw [mul_le]","declUpToTactic":"theorem le_div_iff_mul_le {I J K : Submodule R A} : I ≤ J / K ↔ I * K ≤ J := by\n rw [le_div_iff]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.743_0.IvhXmXo9kppbroj","decl":"theorem le_div_iff_mul_le {I J K : Submodule R A} : I ≤ J / K ↔ I * K ≤ J "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM N : Submodule R A\nm n : A\nI : Submodule R A\n⊢ 1 ≤ 1 / I ↔ I ≤ 1","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n exact subset_span ⟨a, m, Set.mem_singleton a, hm, rfl⟩\n#align submodule.smul_singleton Submodule.smul_singleton\n\nsection Quotient\n\n/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n rw [add_mul]\n exact Submodule.add_mem _ (ha _ hy) (hb _ hy)\n smul_mem' := fun r x hx y hy => by\n rw [Algebra.smul_mul_assoc]\n exact Submodule.smul_mem _ _ (hx _ hy) }⟩\n\ntheorem mem_div_iff_forall_mul_mem {x : A} {I J : Submodule R A} : x ∈ I / J ↔ ∀ y ∈ J, x * y ∈ I :=\n Iff.refl _\n#align submodule.mem_div_iff_forall_mul_mem Submodule.mem_div_iff_forall_mul_mem\n\ntheorem mem_div_iff_smul_subset {x : A} {I J : Submodule R A} : x ∈ I / J ↔ x • (J : Set A) ⊆ I :=\n ⟨fun h y ⟨y', hy', xy'_eq_y⟩ => by\n rw [← xy'_eq_y]\n apply h\n assumption, fun h y hy => h (Set.smul_mem_smul_set hy)⟩\n#align submodule.mem_div_iff_smul_subset Submodule.mem_div_iff_smul_subset\n\ntheorem le_div_iff {I J K : Submodule R A} : I ≤ J / K ↔ ∀ x ∈ I, ∀ z ∈ K, x * z ∈ J :=\n Iff.refl _\n#align submodule.le_div_iff Submodule.le_div_iff\n\ntheorem le_div_iff_mul_le {I J K : Submodule R A} : I ≤ J / K ↔ I * K ≤ J := by\n rw [le_div_iff]\n rw [mul_le]\n#align submodule.le_div_iff_mul_le Submodule.le_div_iff_mul_le\n\n@[simp]\ntheorem one_le_one_div {I : Submodule R A} : 1 ≤ 1 / I ↔ I ≤ 1 := by\n ","nextTactic":"constructor","declUpToTactic":"@[simp]\ntheorem one_le_one_div {I : Submodule R A} : 1 ≤ 1 / I ↔ I ≤ 1 := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.748_0.IvhXmXo9kppbroj","decl":"@[simp]\ntheorem one_le_one_div {I : Submodule R A} : 1 ≤ 1 / I ↔ I ≤ 1 "} +{"state":"case mp\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM N : Submodule R A\nm n : A\nI : Submodule R A\n⊢ 1 ≤ 1 / I → I ≤ 1\ncase mpr\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM N : Submodule R A\nm n : A\nI : Submodule R A\n⊢ I ≤ 1 → 1 ≤ 1 / I","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n exact subset_span ⟨a, m, Set.mem_singleton a, hm, rfl⟩\n#align submodule.smul_singleton Submodule.smul_singleton\n\nsection Quotient\n\n/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y �� I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n rw [add_mul]\n exact Submodule.add_mem _ (ha _ hy) (hb _ hy)\n smul_mem' := fun r x hx y hy => by\n rw [Algebra.smul_mul_assoc]\n exact Submodule.smul_mem _ _ (hx _ hy) }⟩\n\ntheorem mem_div_iff_forall_mul_mem {x : A} {I J : Submodule R A} : x ∈ I / J ↔ ∀ y ∈ J, x * y ∈ I :=\n Iff.refl _\n#align submodule.mem_div_iff_forall_mul_mem Submodule.mem_div_iff_forall_mul_mem\n\ntheorem mem_div_iff_smul_subset {x : A} {I J : Submodule R A} : x ∈ I / J ↔ x • (J : Set A) ⊆ I :=\n ⟨fun h y ⟨y', hy', xy'_eq_y⟩ => by\n rw [← xy'_eq_y]\n apply h\n assumption, fun h y hy => h (Set.smul_mem_smul_set hy)⟩\n#align submodule.mem_div_iff_smul_subset Submodule.mem_div_iff_smul_subset\n\ntheorem le_div_iff {I J K : Submodule R A} : I ≤ J / K ↔ ∀ x ∈ I, ∀ z ∈ K, x * z ∈ J :=\n Iff.refl _\n#align submodule.le_div_iff Submodule.le_div_iff\n\ntheorem le_div_iff_mul_le {I J K : Submodule R A} : I ≤ J / K ↔ I * K ≤ J := by\n rw [le_div_iff]\n rw [mul_le]\n#align submodule.le_div_iff_mul_le Submodule.le_div_iff_mul_le\n\n@[simp]\ntheorem one_le_one_div {I : Submodule R A} : 1 ≤ 1 / I ↔ I ≤ 1 := by\n constructor; ","nextTactic":"all_goals intro hI","declUpToTactic":"@[simp]\ntheorem one_le_one_div {I : Submodule R A} : 1 ≤ 1 / I ↔ I ≤ 1 := by\n constructor; ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.748_0.IvhXmXo9kppbroj","decl":"@[simp]\ntheorem one_le_one_div {I : Submodule R A} : 1 ≤ 1 / I ↔ I ≤ 1 "} +{"state":"case mp\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM N : Submodule R A\nm n : A\nI : Submodule R A\n⊢ 1 ≤ 1 / I → I ≤ 1","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n exact subset_span ⟨a, m, Set.mem_singleton a, hm, rfl⟩\n#align submodule.smul_singleton Submodule.smul_singleton\n\nsection Quotient\n\n/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n rw [add_mul]\n exact Submodule.add_mem _ (ha _ hy) (hb _ hy)\n smul_mem' := fun r x hx y hy => by\n rw [Algebra.smul_mul_assoc]\n exact Submodule.smul_mem _ _ (hx _ hy) }⟩\n\ntheorem mem_div_iff_forall_mul_mem {x : A} {I J : Submodule R A} : x ∈ I / J ↔ ∀ y ∈ J, x * y ∈ I :=\n Iff.refl _\n#align submodule.mem_div_iff_forall_mul_mem Submodule.mem_div_iff_forall_mul_mem\n\ntheorem mem_div_iff_smul_subset {x : A} {I J : Submodule R A} : x ∈ I / J ↔ x • (J : Set A) ⊆ I :=\n ⟨fun h y ⟨y', hy', xy'_eq_y⟩ => by\n rw [← xy'_eq_y]\n apply h\n assumption, fun h y hy => h (Set.smul_mem_smul_set hy)⟩\n#align submodule.mem_div_iff_smul_subset Submodule.mem_div_iff_smul_subset\n\ntheorem le_div_iff {I J K : Submodule R A} : I ≤ J / K ↔ ∀ x ∈ I, ∀ z ∈ K, x * z ∈ J :=\n Iff.refl _\n#align submodule.le_div_iff Submodule.le_div_iff\n\ntheorem le_div_iff_mul_le {I J K : Submodule R A} : I ≤ J / K ↔ I * K ≤ J := by\n rw [le_div_iff]\n rw [mul_le]\n#align submodule.le_div_iff_mul_le Submodule.le_div_iff_mul_le\n\n@[simp]\ntheorem one_le_one_div {I : Submodule R A} : 1 ≤ 1 / I ↔ I ≤ 1 := by\n constructor; all_goals ","nextTactic":"intro hI","declUpToTactic":"@[simp]\ntheorem one_le_one_div {I : Submodule R A} : 1 ≤ 1 / I ↔ I ≤ 1 := by\n constructor; all_goals ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.748_0.IvhXmXo9kppbroj","decl":"@[simp]\ntheorem one_le_one_div {I : Submodule R A} : 1 ≤ 1 / I ↔ I ≤ 1 "} +{"state":"case mpr\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM N : Submodule R A\nm n : A\nI : Submodule R A\n⊢ I ≤ 1 → 1 ≤ 1 / I","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ��� M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ ���ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n exact subset_span ⟨a, m, Set.mem_singleton a, hm, rfl⟩\n#align submodule.smul_singleton Submodule.smul_singleton\n\nsection Quotient\n\n/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n rw [add_mul]\n exact Submodule.add_mem _ (ha _ hy) (hb _ hy)\n smul_mem' := fun r x hx y hy => by\n rw [Algebra.smul_mul_assoc]\n exact Submodule.smul_mem _ _ (hx _ hy) }⟩\n\ntheorem mem_div_iff_forall_mul_mem {x : A} {I J : Submodule R A} : x ∈ I / J ↔ ∀ y ∈ J, x * y ∈ I :=\n Iff.refl _\n#align submodule.mem_div_iff_forall_mul_mem Submodule.mem_div_iff_forall_mul_mem\n\ntheorem mem_div_iff_smul_subset {x : A} {I J : Submodule R A} : x ∈ I / J ↔ x • (J : Set A) ⊆ I :=\n ⟨fun h y ⟨y', hy', xy'_eq_y⟩ => by\n rw [← xy'_eq_y]\n apply h\n assumption, fun h y hy => h (Set.smul_mem_smul_set hy)⟩\n#align submodule.mem_div_iff_smul_subset Submodule.mem_div_iff_smul_subset\n\ntheorem le_div_iff {I J K : Submodule R A} : I ≤ J / K ↔ ∀ x ∈ I, ∀ z ∈ K, x * z ∈ J :=\n Iff.refl _\n#align submodule.le_div_iff Submodule.le_div_iff\n\ntheorem le_div_iff_mul_le {I J K : Submodule R A} : I ≤ J / K ↔ I * K ≤ J := by\n rw [le_div_iff]\n rw [mul_le]\n#align submodule.le_div_iff_mul_le Submodule.le_div_iff_mul_le\n\n@[simp]\ntheorem one_le_one_div {I : Submodule R A} : 1 ≤ 1 / I ↔ I ≤ 1 := by\n constructor; all_goals ","nextTactic":"intro hI","declUpToTactic":"@[simp]\ntheorem one_le_one_div {I : Submodule R A} : 1 ≤ 1 / I ↔ I ≤ 1 := by\n constructor; all_goals ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.748_0.IvhXmXo9kppbroj","decl":"@[simp]\ntheorem one_le_one_div {I : Submodule R A} : 1 ≤ 1 / I ↔ I ≤ 1 "} +{"state":"case mp\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM N : Submodule R A\nm n : A\nI : Submodule R A\nhI : 1 ≤ 1 / I\n⊢ I ≤ 1","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n exact subset_span ⟨a, m, Set.mem_singleton a, hm, rfl⟩\n#align submodule.smul_singleton Submodule.smul_singleton\n\nsection Quotient\n\n/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n rw [add_mul]\n exact Submodule.add_mem _ (ha _ hy) (hb _ hy)\n smul_mem' := fun r x hx y hy => by\n rw [Algebra.smul_mul_assoc]\n exact Submodule.smul_mem _ _ (hx _ hy) }⟩\n\ntheorem mem_div_iff_forall_mul_mem {x : A} {I J : Submodule R A} : x ∈ I / J ↔ ∀ y ∈ J, x * y ∈ I :=\n Iff.refl _\n#align submodule.mem_div_iff_forall_mul_mem Submodule.mem_div_iff_forall_mul_mem\n\ntheorem mem_div_iff_smul_subset {x : A} {I J : Submodule R A} : x ∈ I / J ↔ x • (J : Set A) ⊆ I :=\n ⟨fun h y ⟨y', hy', xy'_eq_y⟩ => by\n rw [← xy'_eq_y]\n apply h\n assumption, fun h y hy => h (Set.smul_mem_smul_set hy)⟩\n#align submodule.mem_div_iff_smul_subset Submodule.mem_div_iff_smul_subset\n\ntheorem le_div_iff {I J K : Submodule R A} : I ≤ J / K ↔ ∀ x ∈ I, ∀ z ∈ K, x * z ∈ J :=\n Iff.refl _\n#align submodule.le_div_iff Submodule.le_div_iff\n\ntheorem le_div_iff_mul_le {I J K : Submodule R A} : I ≤ J / K ↔ I * K ≤ J := by\n rw [le_div_iff]\n rw [mul_le]\n#align submodule.le_div_iff_mul_le Submodule.le_div_iff_mul_le\n\n@[simp]\ntheorem one_le_one_div {I : Submodule R A} : 1 ≤ 1 / I ↔ I ≤ 1 := by\n constructor; all_goals intro hI\n · ","nextTactic":"rwa [le_div_iff_mul_le, one_mul] at hI","declUpToTactic":"@[simp]\ntheorem one_le_one_div {I : Submodule R A} : 1 ≤ 1 / I ↔ I ≤ 1 := by\n constructor; all_goals intro hI\n · ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.748_0.IvhXmXo9kppbroj","decl":"@[simp]\ntheorem one_le_one_div {I : Submodule R A} : 1 ≤ 1 / I ↔ I ≤ 1 "} +{"state":"case mpr\nι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM N : Submodule R A\nm n : A\nI : Submodule R A\nhI : I ≤ 1\n⊢ 1 ≤ 1 / I","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ��� (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n exact subset_span ⟨a, m, Set.mem_singleton a, hm, rfl⟩\n#align submodule.smul_singleton Submodule.smul_singleton\n\nsection Quotient\n\n/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n rw [add_mul]\n exact Submodule.add_mem _ (ha _ hy) (hb _ hy)\n smul_mem' := fun r x hx y hy => by\n rw [Algebra.smul_mul_assoc]\n exact Submodule.smul_mem _ _ (hx _ hy) }⟩\n\ntheorem mem_div_iff_forall_mul_mem {x : A} {I J : Submodule R A} : x ∈ I / J ↔ ∀ y ∈ J, x * y ∈ I :=\n Iff.refl _\n#align submodule.mem_div_iff_forall_mul_mem Submodule.mem_div_iff_forall_mul_mem\n\ntheorem mem_div_iff_smul_subset {x : A} {I J : Submodule R A} : x ∈ I / J ↔ x • (J : Set A) ⊆ I :=\n ⟨fun h y ⟨y', hy', xy'_eq_y⟩ => by\n rw [← xy'_eq_y]\n apply h\n assumption, fun h y hy => h (Set.smul_mem_smul_set hy)⟩\n#align submodule.mem_div_iff_smul_subset Submodule.mem_div_iff_smul_subset\n\ntheorem le_div_iff {I J K : Submodule R A} : I ≤ J / K ↔ ∀ x ∈ I, ∀ z ∈ K, x * z ∈ J :=\n Iff.refl _\n#align submodule.le_div_iff Submodule.le_div_iff\n\ntheorem le_div_iff_mul_le {I J K : Submodule R A} : I ≤ J / K ↔ I * K ≤ J := by\n rw [le_div_iff]\n rw [mul_le]\n#align submodule.le_div_iff_mul_le Submodule.le_div_iff_mul_le\n\n@[simp]\ntheorem one_le_one_div {I : Submodule R A} : 1 ≤ 1 / I ↔ I ≤ 1 := by\n constructor; all_goals intro hI\n · rwa [le_div_iff_mul_le, one_mul] at hI\n · ","nextTactic":"rwa [le_div_iff_mul_le, one_mul]","declUpToTactic":"@[simp]\ntheorem one_le_one_div {I : Submodule R A} : 1 ≤ 1 / I ↔ I ≤ 1 := by\n constructor; all_goals intro hI\n · rwa [le_div_iff_mul_le, one_mul] at hI\n · ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.748_0.IvhXmXo9kppbroj","decl":"@[simp]\ntheorem one_le_one_div {I : Submodule R A} : 1 ≤ 1 / I ↔ I ≤ 1 "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM N : Submodule R A\nm n : A\nI : Submodule R A\nhI : I ≤ 1\n⊢ I ≤ I * (1 / I)","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐ���ᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n exact subset_span ⟨a, m, Set.mem_singleton a, hm, rfl⟩\n#align submodule.smul_singleton Submodule.smul_singleton\n\nsection Quotient\n\n/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n rw [add_mul]\n exact Submodule.add_mem _ (ha _ hy) (hb _ hy)\n smul_mem' := fun r x hx y hy => by\n rw [Algebra.smul_mul_assoc]\n exact Submodule.smul_mem _ _ (hx _ hy) }⟩\n\ntheorem mem_div_iff_forall_mul_mem {x : A} {I J : Submodule R A} : x ∈ I / J ↔ ∀ y ∈ J, x * y ∈ I :=\n Iff.refl _\n#align submodule.mem_div_iff_forall_mul_mem Submodule.mem_div_iff_forall_mul_mem\n\ntheorem mem_div_iff_smul_subset {x : A} {I J : Submodule R A} : x ∈ I / J ↔ x • (J : Set A) ⊆ I :=\n ⟨fun h y ⟨y', hy', xy'_eq_y⟩ => by\n rw [← xy'_eq_y]\n apply h\n assumption, fun h y hy => h (Set.smul_mem_smul_set hy)⟩\n#align submodule.mem_div_iff_smul_subset Submodule.mem_div_iff_smul_subset\n\ntheorem le_div_iff {I J K : Submodule R A} : I ≤ J / K ↔ ∀ x ∈ I, ∀ z ∈ K, x * z ∈ J :=\n Iff.refl _\n#align submodule.le_div_iff Submodule.le_div_iff\n\ntheorem le_div_iff_mul_le {I J K : Submodule R A} : I ≤ J / K ↔ I * K ≤ J := by\n rw [le_div_iff]\n rw [mul_le]\n#align submodule.le_div_iff_mul_le Submodule.le_div_iff_mul_le\n\n@[simp]\ntheorem one_le_one_div {I : Submodule R A} : 1 ≤ 1 / I ↔ I ≤ 1 := by\n constructor; all_goals intro hI\n · rwa [le_div_iff_mul_le, one_mul] at hI\n · rwa [le_div_iff_mul_le, one_mul]\n#align submodule.one_le_one_div Submodule.one_le_one_div\n\ntheorem le_self_mul_one_div {I : Submodule R A} (hI : I ≤ 1) : I ≤ I * (1 / I) := by\n ","nextTactic":"refine (mul_one I).symm.trans_le ?_","declUpToTactic":"theorem le_self_mul_one_div {I : Submodule R A} (hI : I ≤ 1) : I ≤ I * (1 / I) := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.755_0.IvhXmXo9kppbroj","decl":"theorem le_self_mul_one_div {I : Submodule R A} (hI : I ≤ 1) : I ≤ I * (1 / I) "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM N : Submodule R A\nm n : A\nI : Submodule R A\nhI : I ≤ 1\n⊢ I * 1 ≤ I * (1 / I)","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n exact subset_span ⟨a, m, Set.mem_singleton a, hm, rfl⟩\n#align submodule.smul_singleton Submodule.smul_singleton\n\nsection Quotient\n\n/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n rw [add_mul]\n exact Submodule.add_mem _ (ha _ hy) (hb _ hy)\n smul_mem' := fun r x hx y hy => by\n rw [Algebra.smul_mul_assoc]\n exact Submodule.smul_mem _ _ (hx _ hy) }⟩\n\ntheorem mem_div_iff_forall_mul_mem {x : A} {I J : Submodule R A} : x ∈ I / J ↔ ∀ y ∈ J, x * y ∈ I :=\n Iff.refl _\n#align submodule.mem_div_iff_forall_mul_mem Submodule.mem_div_iff_forall_mul_mem\n\ntheorem mem_div_iff_smul_subset {x : A} {I J : Submodule R A} : x ∈ I / J ↔ x • (J : Set A) ⊆ I :=\n ⟨fun h y ⟨y', hy', xy'_eq_y⟩ => by\n rw [← xy'_eq_y]\n apply h\n assumption, fun h y hy => h (Set.smul_mem_smul_set hy)⟩\n#align submodule.mem_div_iff_smul_subset Submodule.mem_div_iff_smul_subset\n\ntheorem le_div_iff {I J K : Submodule R A} : I ≤ J / K ↔ ∀ x ∈ I, ∀ z ∈ K, x * z ∈ J :=\n Iff.refl _\n#align submodule.le_div_iff Submodule.le_div_iff\n\ntheorem le_div_iff_mul_le {I J K : Submodule R A} : I ≤ J / K ↔ I * K ≤ J := by\n rw [le_div_iff]\n rw [mul_le]\n#align submodule.le_div_iff_mul_le Submodule.le_div_iff_mul_le\n\n@[simp]\ntheorem one_le_one_div {I : Submodule R A} : 1 ≤ 1 / I ↔ I ≤ 1 := by\n constructor; all_goals intro hI\n · rwa [le_div_iff_mul_le, one_mul] at hI\n · rwa [le_div_iff_mul_le, one_mul]\n#align submodule.one_le_one_div Submodule.one_le_one_div\n\ntheorem le_self_mul_one_div {I : Submodule R A} (hI : I ≤ 1) : I ≤ I * (1 / I) := by\n refine (mul_one I).symm.trans_le ?_ -- porting note: drop `rw {occs := _}` in favor of `refine`\n ","nextTactic":"apply mul_le_mul_right (one_le_one_div.mpr hI)","declUpToTactic":"theorem le_self_mul_one_div {I : Submodule R A} (hI : I ≤ 1) : I ≤ I * (1 / I) := by\n refine (mul_one I).symm.trans_le ?_ -- porting note: drop `rw {occs := _}` in favor of `refine`\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.755_0.IvhXmXo9kppbroj","decl":"theorem le_self_mul_one_div {I : Submodule R A} (hI : I ≤ 1) : I ≤ I * (1 / I) "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM N : Submodule R A\nm n : A\nI : Submodule R A\n⊢ I * (1 / I) ≤ 1","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n exact subset_span ⟨a, m, Set.mem_singleton a, hm, rfl⟩\n#align submodule.smul_singleton Submodule.smul_singleton\n\nsection Quotient\n\n/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n rw [add_mul]\n exact Submodule.add_mem _ (ha _ hy) (hb _ hy)\n smul_mem' := fun r x hx y hy => by\n rw [Algebra.smul_mul_assoc]\n exact Submodule.smul_mem _ _ (hx _ hy) }⟩\n\ntheorem mem_div_iff_forall_mul_mem {x : A} {I J : Submodule R A} : x ∈ I / J ↔ ∀ y ∈ J, x * y ∈ I :=\n Iff.refl _\n#align submodule.mem_div_iff_forall_mul_mem Submodule.mem_div_iff_forall_mul_mem\n\ntheorem mem_div_iff_smul_subset {x : A} {I J : Submodule R A} : x ∈ I / J ↔ x • (J : Set A) ⊆ I :=\n ⟨fun h y ⟨y', hy', xy'_eq_y⟩ => by\n rw [← xy'_eq_y]\n apply h\n assumption, fun h y hy => h (Set.smul_mem_smul_set hy)⟩\n#align submodule.mem_div_iff_smul_subset Submodule.mem_div_iff_smul_subset\n\ntheorem le_div_iff {I J K : Submodule R A} : I ≤ J / K ↔ ∀ x ∈ I, ∀ z ∈ K, x * z ∈ J :=\n Iff.refl _\n#align submodule.le_div_iff Submodule.le_div_iff\n\ntheorem le_div_iff_mul_le {I J K : Submodule R A} : I ≤ J / K ↔ I * K ≤ J := by\n rw [le_div_iff]\n rw [mul_le]\n#align submodule.le_div_iff_mul_le Submodule.le_div_iff_mul_le\n\n@[simp]\ntheorem one_le_one_div {I : Submodule R A} : 1 ≤ 1 / I ↔ I ≤ 1 := by\n constructor; all_goals intro hI\n · rwa [le_div_iff_mul_le, one_mul] at hI\n · rwa [le_div_iff_mul_le, one_mul]\n#align submodule.one_le_one_div Submodule.one_le_one_div\n\ntheorem le_self_mul_one_div {I : Submodule R A} (hI : I ≤ 1) : I ≤ I * (1 / I) := by\n refine (mul_one I).symm.trans_le ?_ -- porting note: drop `rw {occs := _}` in favor of `refine`\n apply mul_le_mul_right (one_le_one_div.mpr hI)\n#align submodule.le_self_mul_one_div Submodule.le_self_mul_one_div\n\ntheorem mul_one_div_le_one {I : Submodule R A} : I * (1 / I) ≤ 1 := by\n ","nextTactic":"rw [Submodule.mul_le]","declUpToTactic":"theorem mul_one_div_le_one {I : Submodule R A} : I * (1 / I) ≤ 1 := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.760_0.IvhXmXo9kppbroj","decl":"theorem mul_one_div_le_one {I : Submodule R A} : I * (1 / I) ≤ 1 "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM N : Submodule R A\nm n : A\nI : Submodule R A\n⊢ ∀ m ∈ I, ∀ n ∈ 1 / I, m * n ∈ 1","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐ��ᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n exact subset_span ⟨a, m, Set.mem_singleton a, hm, rfl⟩\n#align submodule.smul_singleton Submodule.smul_singleton\n\nsection Quotient\n\n/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n rw [add_mul]\n exact Submodule.add_mem _ (ha _ hy) (hb _ hy)\n smul_mem' := fun r x hx y hy => by\n rw [Algebra.smul_mul_assoc]\n exact Submodule.smul_mem _ _ (hx _ hy) }⟩\n\ntheorem mem_div_iff_forall_mul_mem {x : A} {I J : Submodule R A} : x ∈ I / J ↔ ∀ y ∈ J, x * y ∈ I :=\n Iff.refl _\n#align submodule.mem_div_iff_forall_mul_mem Submodule.mem_div_iff_forall_mul_mem\n\ntheorem mem_div_iff_smul_subset {x : A} {I J : Submodule R A} : x ∈ I / J ↔ x • (J : Set A) ⊆ I :=\n ⟨fun h y ⟨y', hy', xy'_eq_y⟩ => by\n rw [← xy'_eq_y]\n apply h\n assumption, fun h y hy => h (Set.smul_mem_smul_set hy)⟩\n#align submodule.mem_div_iff_smul_subset Submodule.mem_div_iff_smul_subset\n\ntheorem le_div_iff {I J K : Submodule R A} : I ≤ J / K ↔ ∀ x ∈ I, ∀ z ∈ K, x * z ∈ J :=\n Iff.refl _\n#align submodule.le_div_iff Submodule.le_div_iff\n\ntheorem le_div_iff_mul_le {I J K : Submodule R A} : I ≤ J / K ↔ I * K ≤ J := by\n rw [le_div_iff]\n rw [mul_le]\n#align submodule.le_div_iff_mul_le Submodule.le_div_iff_mul_le\n\n@[simp]\ntheorem one_le_one_div {I : Submodule R A} : 1 ≤ 1 / I ↔ I ≤ 1 := by\n constructor; all_goals intro hI\n · rwa [le_div_iff_mul_le, one_mul] at hI\n · rwa [le_div_iff_mul_le, one_mul]\n#align submodule.one_le_one_div Submodule.one_le_one_div\n\ntheorem le_self_mul_one_div {I : Submodule R A} (hI : I ≤ 1) : I ≤ I * (1 / I) := by\n refine (mul_one I).symm.trans_le ?_ -- porting note: drop `rw {occs := _}` in favor of `refine`\n apply mul_le_mul_right (one_le_one_div.mpr hI)\n#align submodule.le_self_mul_one_div Submodule.le_self_mul_one_div\n\ntheorem mul_one_div_le_one {I : Submodule R A} : I * (1 / I) ≤ 1 := by\n rw [Submodule.mul_le]\n ","nextTactic":"intro m hm n hn","declUpToTactic":"theorem mul_one_div_le_one {I : Submodule R A} : I * (1 / I) ≤ 1 := by\n rw [Submodule.mul_le]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.760_0.IvhXmXo9kppbroj","decl":"theorem mul_one_div_le_one {I : Submodule R A} : I * (1 / I) ≤ 1 "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM N : Submodule R A\nm✝ n✝ : A\nI : Submodule R A\nm : A\nhm : m ∈ I\nn : A\nhn : n ∈ 1 / I\n⊢ m * n ∈ 1","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n exact subset_span ⟨a, m, Set.mem_singleton a, hm, rfl⟩\n#align submodule.smul_singleton Submodule.smul_singleton\n\nsection Quotient\n\n/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n rw [add_mul]\n exact Submodule.add_mem _ (ha _ hy) (hb _ hy)\n smul_mem' := fun r x hx y hy => by\n rw [Algebra.smul_mul_assoc]\n exact Submodule.smul_mem _ _ (hx _ hy) }⟩\n\ntheorem mem_div_iff_forall_mul_mem {x : A} {I J : Submodule R A} : x ∈ I / J ↔ ∀ y ∈ J, x * y ∈ I :=\n Iff.refl _\n#align submodule.mem_div_iff_forall_mul_mem Submodule.mem_div_iff_forall_mul_mem\n\ntheorem mem_div_iff_smul_subset {x : A} {I J : Submodule R A} : x ∈ I / J ↔ x • (J : Set A) ⊆ I :=\n ⟨fun h y ⟨y', hy', xy'_eq_y⟩ => by\n rw [← xy'_eq_y]\n apply h\n assumption, fun h y hy => h (Set.smul_mem_smul_set hy)⟩\n#align submodule.mem_div_iff_smul_subset Submodule.mem_div_iff_smul_subset\n\ntheorem le_div_iff {I J K : Submodule R A} : I ≤ J / K ↔ ∀ x �� I, ∀ z ∈ K, x * z ∈ J :=\n Iff.refl _\n#align submodule.le_div_iff Submodule.le_div_iff\n\ntheorem le_div_iff_mul_le {I J K : Submodule R A} : I ≤ J / K ↔ I * K ≤ J := by\n rw [le_div_iff]\n rw [mul_le]\n#align submodule.le_div_iff_mul_le Submodule.le_div_iff_mul_le\n\n@[simp]\ntheorem one_le_one_div {I : Submodule R A} : 1 ≤ 1 / I ↔ I ≤ 1 := by\n constructor; all_goals intro hI\n · rwa [le_div_iff_mul_le, one_mul] at hI\n · rwa [le_div_iff_mul_le, one_mul]\n#align submodule.one_le_one_div Submodule.one_le_one_div\n\ntheorem le_self_mul_one_div {I : Submodule R A} (hI : I ≤ 1) : I ≤ I * (1 / I) := by\n refine (mul_one I).symm.trans_le ?_ -- porting note: drop `rw {occs := _}` in favor of `refine`\n apply mul_le_mul_right (one_le_one_div.mpr hI)\n#align submodule.le_self_mul_one_div Submodule.le_self_mul_one_div\n\ntheorem mul_one_div_le_one {I : Submodule R A} : I * (1 / I) ≤ 1 := by\n rw [Submodule.mul_le]\n intro m hm n hn\n ","nextTactic":"rw [Submodule.mem_div_iff_forall_mul_mem] at hn","declUpToTactic":"theorem mul_one_div_le_one {I : Submodule R A} : I * (1 / I) ≤ 1 := by\n rw [Submodule.mul_le]\n intro m hm n hn\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.760_0.IvhXmXo9kppbroj","decl":"theorem mul_one_div_le_one {I : Submodule R A} : I * (1 / I) ≤ 1 "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM N : Submodule R A\nm✝ n✝ : A\nI : Submodule R A\nm : A\nhm : m ∈ I\nn : A\nhn : ∀ y ∈ I, n * y ∈ 1\n⊢ m * n ∈ 1","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n exact subset_span ⟨a, m, Set.mem_singleton a, hm, rfl⟩\n#align submodule.smul_singleton Submodule.smul_singleton\n\nsection Quotient\n\n/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n rw [add_mul]\n exact Submodule.add_mem _ (ha _ hy) (hb _ hy)\n smul_mem' := fun r x hx y hy => by\n rw [Algebra.smul_mul_assoc]\n exact Submodule.smul_mem _ _ (hx _ hy) }⟩\n\ntheorem mem_div_iff_forall_mul_mem {x : A} {I J : Submodule R A} : x ∈ I / J ↔ ∀ y ∈ J, x * y ∈ I :=\n Iff.refl _\n#align submodule.mem_div_iff_forall_mul_mem Submodule.mem_div_iff_forall_mul_mem\n\ntheorem mem_div_iff_smul_subset {x : A} {I J : Submodule R A} : x ∈ I / J ↔ x • (J : Set A) ⊆ I :=\n ⟨fun h y ⟨y', hy', xy'_eq_y⟩ => by\n rw [← xy'_eq_y]\n apply h\n assumption, fun h y hy => h (Set.smul_mem_smul_set hy)⟩\n#align submodule.mem_div_iff_smul_subset Submodule.mem_div_iff_smul_subset\n\ntheorem le_div_iff {I J K : Submodule R A} : I ≤ J / K ↔ ∀ x ∈ I, ∀ z ∈ K, x * z ∈ J :=\n Iff.refl _\n#align submodule.le_div_iff Submodule.le_div_iff\n\ntheorem le_div_iff_mul_le {I J K : Submodule R A} : I ≤ J / K ↔ I * K ≤ J := by\n rw [le_div_iff]\n rw [mul_le]\n#align submodule.le_div_iff_mul_le Submodule.le_div_iff_mul_le\n\n@[simp]\ntheorem one_le_one_div {I : Submodule R A} : 1 ≤ 1 / I ↔ I ≤ 1 := by\n constructor; all_goals intro hI\n · rwa [le_div_iff_mul_le, one_mul] at hI\n · rwa [le_div_iff_mul_le, one_mul]\n#align submodule.one_le_one_div Submodule.one_le_one_div\n\ntheorem le_self_mul_one_div {I : Submodule R A} (hI : I ≤ 1) : I ≤ I * (1 / I) := by\n refine (mul_one I).symm.trans_le ?_ -- porting note: drop `rw {occs := _}` in favor of `refine`\n apply mul_le_mul_right (one_le_one_div.mpr hI)\n#align submodule.le_self_mul_one_div Submodule.le_self_mul_one_div\n\ntheorem mul_one_div_le_one {I : Submodule R A} : I * (1 / I) ≤ 1 := by\n rw [Submodule.mul_le]\n intro m hm n hn\n rw [Submodule.mem_div_iff_forall_mul_mem] at hn\n ","nextTactic":"rw [mul_comm]","declUpToTactic":"theorem mul_one_div_le_one {I : Submodule R A} : I * (1 / I) ≤ 1 := by\n rw [Submodule.mul_le]\n intro m hm n hn\n rw [Submodule.mem_div_iff_forall_mul_mem] at hn\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.760_0.IvhXmXo9kppbroj","decl":"theorem mul_one_div_le_one {I : Submodule R A} : I * (1 / I) ≤ 1 "} +{"state":"ι : Sort uι\nR : Type u\ninst✝² : CommSemiring R\nA : Type v\ninst✝¹ : CommSemiring A\ninst✝ : Algebra R A\nM N : Submodule R A\nm✝ n✝ : A\nI : Submodule R A\nm : A\nhm : m ∈ I\nn : A\nhn : ∀ y ∈ I, n * y ∈ 1\n⊢ n * m ∈ 1","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] A��ᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n exact subset_span ⟨a, m, Set.mem_singleton a, hm, rfl⟩\n#align submodule.smul_singleton Submodule.smul_singleton\n\nsection Quotient\n\n/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n rw [add_mul]\n exact Submodule.add_mem _ (ha _ hy) (hb _ hy)\n smul_mem' := fun r x hx y hy => by\n rw [Algebra.smul_mul_assoc]\n exact Submodule.smul_mem _ _ (hx _ hy) }⟩\n\ntheorem mem_div_iff_forall_mul_mem {x : A} {I J : Submodule R A} : x ∈ I / J ↔ ∀ y ∈ J, x * y ∈ I :=\n Iff.refl _\n#align submodule.mem_div_iff_forall_mul_mem Submodule.mem_div_iff_forall_mul_mem\n\ntheorem mem_div_iff_smul_subset {x : A} {I J : Submodule R A} : x ∈ I / J ↔ x • (J : Set A) ⊆ I :=\n ⟨fun h y ⟨y', hy', xy'_eq_y⟩ => by\n rw [← xy'_eq_y]\n apply h\n assumption, fun h y hy => h (Set.smul_mem_smul_set hy)⟩\n#align submodule.mem_div_iff_smul_subset Submodule.mem_div_iff_smul_subset\n\ntheorem le_div_iff {I J K : Submodule R A} : I ≤ J / K ↔ ∀ x ∈ I, ∀ z ∈ K, x * z ∈ J :=\n Iff.refl _\n#align submodule.le_div_iff Submodule.le_div_iff\n\ntheorem le_div_iff_mul_le {I J K : Submodule R A} : I ≤ J / K ↔ I * K ≤ J := by\n rw [le_div_iff]\n rw [mul_le]\n#align submodule.le_div_iff_mul_le Submodule.le_div_iff_mul_le\n\n@[simp]\ntheorem one_le_one_div {I : Submodule R A} : 1 ≤ 1 / I ↔ I ≤ 1 := by\n constructor; all_goals intro hI\n · rwa [le_div_iff_mul_le, one_mul] at hI\n · rwa [le_div_iff_mul_le, one_mul]\n#align submodule.one_le_one_div Submodule.one_le_one_div\n\ntheorem le_self_mul_one_div {I : Submodule R A} (hI : I ≤ 1) : I ≤ I * (1 / I) := by\n refine (mul_one I).symm.trans_le ?_ -- porting note: drop `rw {occs := _}` in favor of `refine`\n apply mul_le_mul_right (one_le_one_div.mpr hI)\n#align submodule.le_self_mul_one_div Submodule.le_self_mul_one_div\n\ntheorem mul_one_div_le_one {I : Submodule R A} : I * (1 / I) ≤ 1 := by\n rw [Submodule.mul_le]\n intro m hm n hn\n rw [Submodule.mem_div_iff_forall_mul_mem] at hn\n rw [mul_comm]\n ","nextTactic":"exact hn m hm","declUpToTactic":"theorem mul_one_div_le_one {I : Submodule R A} : I * (1 / I) ≤ 1 := by\n rw [Submodule.mul_le]\n intro m hm n hn\n rw [Submodule.mem_div_iff_forall_mul_mem] at hn\n rw [mul_comm]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.760_0.IvhXmXo9kppbroj","decl":"theorem mul_one_div_le_one {I : Submodule R A} : I * (1 / I) ≤ 1 "} +{"state":"ι : Sort uι\nR : Type u\ninst✝⁴ : CommSemiring R\nA : Type v\ninst✝³ : CommSemiring A\ninst✝² : Algebra R A\nM N : Submodule R A\nm n : A\nB : Type u_1\ninst✝¹ : CommSemiring B\ninst✝ : Algebra R B\nI J : Submodule R A\nh : A ≃ₐ[R] B\n⊢ map (AlgEquiv.toLinearMap h) (I / J) = map (AlgEquiv.toLinearMap h) I / map (AlgEquiv.toLinearMap h) J","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ ��ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n exact subset_span ⟨a, m, Set.mem_singleton a, hm, rfl⟩\n#align submodule.smul_singleton Submodule.smul_singleton\n\nsection Quotient\n\n/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n rw [add_mul]\n exact Submodule.add_mem _ (ha _ hy) (hb _ hy)\n smul_mem' := fun r x hx y hy => by\n rw [Algebra.smul_mul_assoc]\n exact Submodule.smul_mem _ _ (hx _ hy) }⟩\n\ntheorem mem_div_iff_forall_mul_mem {x : A} {I J : Submodule R A} : x ∈ I / J ↔ ∀ y ∈ J, x * y ∈ I :=\n Iff.refl _\n#align submodule.mem_div_iff_forall_mul_mem Submodule.mem_div_iff_forall_mul_mem\n\ntheorem mem_div_iff_smul_subset {x : A} {I J : Submodule R A} : x ∈ I / J ↔ x • (J : Set A) ⊆ I :=\n ⟨fun h y ⟨y', hy', xy'_eq_y⟩ => by\n rw [← xy'_eq_y]\n apply h\n assumption, fun h y hy => h (Set.smul_mem_smul_set hy)⟩\n#align submodule.mem_div_iff_smul_subset Submodule.mem_div_iff_smul_subset\n\ntheorem le_div_iff {I J K : Submodule R A} : I ≤ J / K ↔ ∀ x ∈ I, ∀ z ∈ K, x * z ∈ J :=\n Iff.refl _\n#align submodule.le_div_iff Submodule.le_div_iff\n\ntheorem le_div_iff_mul_le {I J K : Submodule R A} : I ≤ J / K ↔ I * K ≤ J := by\n rw [le_div_iff]\n rw [mul_le]\n#align submodule.le_div_iff_mul_le Submodule.le_div_iff_mul_le\n\n@[simp]\ntheorem one_le_one_div {I : Submodule R A} : 1 ≤ 1 / I ↔ I ≤ 1 := by\n constructor; all_goals intro hI\n · rwa [le_div_iff_mul_le, one_mul] at hI\n · rwa [le_div_iff_mul_le, one_mul]\n#align submodule.one_le_one_div Submodule.one_le_one_div\n\ntheorem le_self_mul_one_div {I : Submodule R A} (hI : I ≤ 1) : I ≤ I * (1 / I) := by\n refine (mul_one I).symm.trans_le ?_ -- porting note: drop `rw {occs := _}` in favor of `refine`\n apply mul_le_mul_right (one_le_one_div.mpr hI)\n#align submodule.le_self_mul_one_div Submodule.le_self_mul_one_div\n\ntheorem mul_one_div_le_one {I : Submodule R A} : I * (1 / I) ≤ 1 := by\n rw [Submodule.mul_le]\n intro m hm n hn\n rw [Submodule.mem_div_iff_forall_mul_mem] at hn\n rw [mul_comm]\n exact hn m hm\n#align submodule.mul_one_div_le_one Submodule.mul_one_div_le_one\n\n@[simp]\nprotected theorem map_div {B : Type*} [CommSemiring B] [Algebra R B] (I J : Submodule R A)\n (h : A ≃ₐ[R] B) : (I / J).map h.toLinearMap = I.map h.toLinearMap / J.map h.toLinearMap := by\n ","nextTactic":"ext x","declUpToTactic":"@[simp]\nprotected theorem map_div {B : Type*} [CommSemiring B] [Algebra R B] (I J : Submodule R A)\n (h : A ≃ₐ[R] B) : (I / J).map h.toLinearMap = I.map h.toLinearMap / J.map h.toLinearMap := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.768_0.IvhXmXo9kppbroj","decl":"@[simp]\nprotected theorem map_div {B : Type*} [CommSemiring B] [Algebra R B] (I J : Submodule R A)\n (h : A ≃ₐ[R] B) : (I / J).map h.toLinearMap = I.map h.toLinearMap / J.map h.toLinearMap "} +{"state":"case h\nι : Sort uι\nR : Type u\ninst✝⁴ : CommSemiring R\nA : Type v\ninst✝³ : CommSemiring A\ninst✝² : Algebra R A\nM N : Submodule R A\nm n : A\nB : Type u_1\ninst✝¹ : CommSemiring B\ninst✝ : Algebra R B\nI J : Submodule R A\nh : A ≃ₐ[R] B\nx : B\n⊢ x ∈ map (AlgEquiv.toLinearMap h) (I / J) ↔ x ∈ map (AlgEquiv.toLinearMap h) I / map (AlgEquiv.toLinearMap h) J","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐ��ᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n exact subset_span ⟨a, m, Set.mem_singleton a, hm, rfl⟩\n#align submodule.smul_singleton Submodule.smul_singleton\n\nsection Quotient\n\n/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n rw [add_mul]\n exact Submodule.add_mem _ (ha _ hy) (hb _ hy)\n smul_mem' := fun r x hx y hy => by\n rw [Algebra.smul_mul_assoc]\n exact Submodule.smul_mem _ _ (hx _ hy) }⟩\n\ntheorem mem_div_iff_forall_mul_mem {x : A} {I J : Submodule R A} : x ∈ I / J ↔ ∀ y ∈ J, x * y ∈ I :=\n Iff.refl _\n#align submodule.mem_div_iff_forall_mul_mem Submodule.mem_div_iff_forall_mul_mem\n\ntheorem mem_div_iff_smul_subset {x : A} {I J : Submodule R A} : x ∈ I / J ↔ x • (J : Set A) ⊆ I :=\n ⟨fun h y ⟨y', hy', xy'_eq_y⟩ => by\n rw [← xy'_eq_y]\n apply h\n assumption, fun h y hy => h (Set.smul_mem_smul_set hy)⟩\n#align submodule.mem_div_iff_smul_subset Submodule.mem_div_iff_smul_subset\n\ntheorem le_div_iff {I J K : Submodule R A} : I ≤ J / K ↔ ∀ x ∈ I, ∀ z ∈ K, x * z ∈ J :=\n Iff.refl _\n#align submodule.le_div_iff Submodule.le_div_iff\n\ntheorem le_div_iff_mul_le {I J K : Submodule R A} : I ≤ J / K ↔ I * K ≤ J := by\n rw [le_div_iff]\n rw [mul_le]\n#align submodule.le_div_iff_mul_le Submodule.le_div_iff_mul_le\n\n@[simp]\ntheorem one_le_one_div {I : Submodule R A} : 1 ≤ 1 / I ↔ I ≤ 1 := by\n constructor; all_goals intro hI\n · rwa [le_div_iff_mul_le, one_mul] at hI\n · rwa [le_div_iff_mul_le, one_mul]\n#align submodule.one_le_one_div Submodule.one_le_one_div\n\ntheorem le_self_mul_one_div {I : Submodule R A} (hI : I ≤ 1) : I ≤ I * (1 / I) := by\n refine (mul_one I).symm.trans_le ?_ -- porting note: drop `rw {occs := _}` in favor of `refine`\n apply mul_le_mul_right (one_le_one_div.mpr hI)\n#align submodule.le_self_mul_one_div Submodule.le_self_mul_one_div\n\ntheorem mul_one_div_le_one {I : Submodule R A} : I * (1 / I) ≤ 1 := by\n rw [Submodule.mul_le]\n intro m hm n hn\n rw [Submodule.mem_div_iff_forall_mul_mem] at hn\n rw [mul_comm]\n exact hn m hm\n#align submodule.mul_one_div_le_one Submodule.mul_one_div_le_one\n\n@[simp]\nprotected theorem map_div {B : Type*} [CommSemiring B] [Algebra R B] (I J : Submodule R A)\n (h : A ≃ₐ[R] B) : (I / J).map h.toLinearMap = I.map h.toLinearMap / J.map h.toLinearMap := by\n ext x\n ","nextTactic":"simp only [mem_map, mem_div_iff_forall_mul_mem]","declUpToTactic":"@[simp]\nprotected theorem map_div {B : Type*} [CommSemiring B] [Algebra R B] (I J : Submodule R A)\n (h : A ≃ₐ[R] B) : (I / J).map h.toLinearMap = I.map h.toLinearMap / J.map h.toLinearMap := by\n ext x\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.768_0.IvhXmXo9kppbroj","decl":"@[simp]\nprotected theorem map_div {B : Type*} [CommSemiring B] [Algebra R B] (I J : Submodule R A)\n (h : A ≃ₐ[R] B) : (I / J).map h.toLinearMap = I.map h.toLinearMap / J.map h.toLinearMap "} +{"state":"case h\nι : Sort uι\nR : Type u\ninst✝⁴ : CommSemiring R\nA : Type v\ninst✝³ : CommSemiring A\ninst✝² : Algebra R A\nM N : Submodule R A\nm n : A\nB : Type u_1\ninst✝¹ : CommSemiring B\ninst✝ : Algebra R B\nI J : Submodule R A\nh : A ≃ₐ[R] B\nx : B\n⊢ (∃ y, (∀ y_1 ∈ J, y * y_1 ∈ I) ∧ (AlgEquiv.toLinearMap h) y = x) ↔\n ∀ (y : B), (∃ y_1 ∈ J, (AlgEquiv.toLinearMap h) y_1 = y) → ∃ y_1 ∈ I, (AlgEquiv.toLinearMap h) y_1 = x * y","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒ���) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n exact subset_span ⟨a, m, Set.mem_singleton a, hm, rfl⟩\n#align submodule.smul_singleton Submodule.smul_singleton\n\nsection Quotient\n\n/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n rw [add_mul]\n exact Submodule.add_mem _ (ha _ hy) (hb _ hy)\n smul_mem' := fun r x hx y hy => by\n rw [Algebra.smul_mul_assoc]\n exact Submodule.smul_mem _ _ (hx _ hy) }⟩\n\ntheorem mem_div_iff_forall_mul_mem {x : A} {I J : Submodule R A} : x ∈ I / J ↔ ∀ y ∈ J, x * y ∈ I :=\n Iff.refl _\n#align submodule.mem_div_iff_forall_mul_mem Submodule.mem_div_iff_forall_mul_mem\n\ntheorem mem_div_iff_smul_subset {x : A} {I J : Submodule R A} : x ∈ I / J ↔ x • (J : Set A) ⊆ I :=\n ⟨fun h y ⟨y', hy', xy'_eq_y⟩ => by\n rw [← xy'_eq_y]\n apply h\n assumption, fun h y hy => h (Set.smul_mem_smul_set hy)⟩\n#align submodule.mem_div_iff_smul_subset Submodule.mem_div_iff_smul_subset\n\ntheorem le_div_iff {I J K : Submodule R A} : I ≤ J / K ↔ ∀ x ∈ I, ∀ z ∈ K, x * z ∈ J :=\n Iff.refl _\n#align submodule.le_div_iff Submodule.le_div_iff\n\ntheorem le_div_iff_mul_le {I J K : Submodule R A} : I ≤ J / K ↔ I * K ≤ J := by\n rw [le_div_iff]\n rw [mul_le]\n#align submodule.le_div_iff_mul_le Submodule.le_div_iff_mul_le\n\n@[simp]\ntheorem one_le_one_div {I : Submodule R A} : 1 ≤ 1 / I ↔ I ≤ 1 := by\n constructor; all_goals intro hI\n · rwa [le_div_iff_mul_le, one_mul] at hI\n · rwa [le_div_iff_mul_le, one_mul]\n#align submodule.one_le_one_div Submodule.one_le_one_div\n\ntheorem le_self_mul_one_div {I : Submodule R A} (hI : I ≤ 1) : I ≤ I * (1 / I) := by\n refine (mul_one I).symm.trans_le ?_ -- porting note: drop `rw {occs := _}` in favor of `refine`\n apply mul_le_mul_right (one_le_one_div.mpr hI)\n#align submodule.le_self_mul_one_div Submodule.le_self_mul_one_div\n\ntheorem mul_one_div_le_one {I : Submodule R A} : I * (1 / I) ≤ 1 := by\n rw [Submodule.mul_le]\n intro m hm n hn\n rw [Submodule.mem_div_iff_forall_mul_mem] at hn\n rw [mul_comm]\n exact hn m hm\n#align submodule.mul_one_div_le_one Submodule.mul_one_div_le_one\n\n@[simp]\nprotected theorem map_div {B : Type*} [CommSemiring B] [Algebra R B] (I J : Submodule R A)\n (h : A ≃ₐ[R] B) : (I / J).map h.toLinearMap = I.map h.toLinearMap / J.map h.toLinearMap := by\n ext x\n simp only [mem_map, mem_div_iff_forall_mul_mem]\n ","nextTactic":"constructor","declUpToTactic":"@[simp]\nprotected theorem map_div {B : Type*} [CommSemiring B] [Algebra R B] (I J : Submodule R A)\n (h : A ≃ₐ[R] B) : (I / J).map h.toLinearMap = I.map h.toLinearMap / J.map h.toLinearMap := by\n ext x\n simp only [mem_map, mem_div_iff_forall_mul_mem]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.768_0.IvhXmXo9kppbroj","decl":"@[simp]\nprotected theorem map_div {B : Type*} [CommSemiring B] [Algebra R B] (I J : Submodule R A)\n (h : A ≃ₐ[R] B) : (I / J).map h.toLinearMap = I.map h.toLinearMap / J.map h.toLinearMap "} +{"state":"case h.mp\nι : Sort uι\nR : Type u\ninst✝⁴ : CommSemiring R\nA : Type v\ninst✝³ : CommSemiring A\ninst✝² : Algebra R A\nM N : Submodule R A\nm n : A\nB : Type u_1\ninst✝¹ : CommSemiring B\ninst✝ : Algebra R B\nI J : Submodule R A\nh : A ≃ₐ[R] B\nx : B\n⊢ (∃ y, (∀ y_1 ∈ J, y * y_1 ∈ I) ∧ (AlgEquiv.toLinearMap h) y = x) →\n ∀ (y : B), (∃ y_1 ∈ J, (AlgEquiv.toLinearMap h) y_1 = y) → ∃ y_1 ∈ I, (AlgEquiv.toLinearMap h) y_1 = x * y","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n exact subset_span ⟨a, m, Set.mem_singleton a, hm, rfl⟩\n#align submodule.smul_singleton Submodule.smul_singleton\n\nsection Quotient\n\n/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n rw [add_mul]\n exact Submodule.add_mem _ (ha _ hy) (hb _ hy)\n smul_mem' := fun r x hx y hy => by\n rw [Algebra.smul_mul_assoc]\n exact Submodule.smul_mem _ _ (hx _ hy) }⟩\n\ntheorem mem_div_iff_forall_mul_mem {x : A} {I J : Submodule R A} : x ∈ I / J ↔ ∀ y ∈ J, x * y ∈ I :=\n Iff.refl _\n#align submodule.mem_div_iff_forall_mul_mem Submodule.mem_div_iff_forall_mul_mem\n\ntheorem mem_div_iff_smul_subset {x : A} {I J : Submodule R A} : x ∈ I / J ↔ x • (J : Set A) ⊆ I :=\n ⟨fun h y ⟨y', hy', xy'_eq_y⟩ => by\n rw [← xy'_eq_y]\n apply h\n assumption, fun h y hy => h (Set.smul_mem_smul_set hy)⟩\n#align submodule.mem_div_iff_smul_subset Submodule.mem_div_iff_smul_subset\n\ntheorem le_div_iff {I J K : Submodule R A} : I ≤ J / K ↔ ∀ x ∈ I, ∀ z ∈ K, x * z ∈ J :=\n Iff.refl _\n#align submodule.le_div_iff Submodule.le_div_iff\n\ntheorem le_div_iff_mul_le {I J K : Submodule R A} : I ≤ J / K ↔ I * K ≤ J := by\n rw [le_div_iff]\n rw [mul_le]\n#align submodule.le_div_iff_mul_le Submodule.le_div_iff_mul_le\n\n@[simp]\ntheorem one_le_one_div {I : Submodule R A} : 1 ≤ 1 / I ↔ I ≤ 1 := by\n constructor; all_goals intro hI\n · rwa [le_div_iff_mul_le, one_mul] at hI\n · rwa [le_div_iff_mul_le, one_mul]\n#align submodule.one_le_one_div Submodule.one_le_one_div\n\ntheorem le_self_mul_one_div {I : Submodule R A} (hI : I ≤ 1) : I ≤ I * (1 / I) := by\n refine (mul_one I).symm.trans_le ?_ -- porting note: drop `rw {occs := _}` in favor of `refine`\n apply mul_le_mul_right (one_le_one_div.mpr hI)\n#align submodule.le_self_mul_one_div Submodule.le_self_mul_one_div\n\ntheorem mul_one_div_le_one {I : Submodule R A} : I * (1 / I) ≤ 1 := by\n rw [Submodule.mul_le]\n intro m hm n hn\n rw [Submodule.mem_div_iff_forall_mul_mem] at hn\n rw [mul_comm]\n exact hn m hm\n#align submodule.mul_one_div_le_one Submodule.mul_one_div_le_one\n\n@[simp]\nprotected theorem map_div {B : Type*} [CommSemiring B] [Algebra R B] (I J : Submodule R A)\n (h : A ≃ₐ[R] B) : (I / J).map h.toLinearMap = I.map h.toLinearMap / J.map h.toLinearMap := by\n ext x\n simp only [mem_map, mem_div_iff_forall_mul_mem]\n constructor\n · ","nextTactic":"rintro ⟨x, hx, rfl⟩ _ ⟨y, hy, rfl⟩","declUpToTactic":"@[simp]\nprotected theorem map_div {B : Type*} [CommSemiring B] [Algebra R B] (I J : Submodule R A)\n (h : A ≃ₐ[R] B) : (I / J).map h.toLinearMap = I.map h.toLinearMap / J.map h.toLinearMap := by\n ext x\n simp only [mem_map, mem_div_iff_forall_mul_mem]\n constructor\n · ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.768_0.IvhXmXo9kppbroj","decl":"@[simp]\nprotected theorem map_div {B : Type*} [CommSemiring B] [Algebra R B] (I J : Submodule R A)\n (h : A ≃ₐ[R] B) : (I / J).map h.toLinearMap = I.map h.toLinearMap / J.map h.toLinearMap "} +{"state":"case h.mp.intro.intro.intro.intro\nι : Sort uι\nR : Type u\ninst✝⁴ : CommSemiring R\nA : Type v\ninst✝³ : CommSemiring A\ninst✝² : Algebra R A\nM N : Submodule R A\nm n : A\nB : Type u_1\ninst✝¹ : CommSemiring B\ninst✝ : Algebra R B\nI J : Submodule R A\nh : A ≃ₐ[R] B\nx : A\nhx : ∀ y ∈ J, x * y ∈ I\ny : A\nhy : y ∈ J\n⊢ ∃ y_1 ∈ I, (AlgEquiv.toLinearMap h) y_1 = (AlgEquiv.toLinearMap h) x * (AlgEquiv.toLinearMap h) y","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n exact subset_span ⟨a, m, Set.mem_singleton a, hm, rfl⟩\n#align submodule.smul_singleton Submodule.smul_singleton\n\nsection Quotient\n\n/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n rw [add_mul]\n exact Submodule.add_mem _ (ha _ hy) (hb _ hy)\n smul_mem' := fun r x hx y hy => by\n rw [Algebra.smul_mul_assoc]\n exact Submodule.smul_mem _ _ (hx _ hy) }⟩\n\ntheorem mem_div_iff_forall_mul_mem {x : A} {I J : Submodule R A} : x ∈ I / J ↔ ∀ y ∈ J, x * y ∈ I :=\n Iff.refl _\n#align submodule.mem_div_iff_forall_mul_mem Submodule.mem_div_iff_forall_mul_mem\n\ntheorem mem_div_iff_smul_subset {x : A} {I J : Submodule R A} : x ∈ I / J ↔ x • (J : Set A) ⊆ I :=\n ⟨fun h y ⟨y', hy', xy'_eq_y⟩ => by\n rw [← xy'_eq_y]\n apply h\n assumption, fun h y hy => h (Set.smul_mem_smul_set hy)⟩\n#align submodule.mem_div_iff_smul_subset Submodule.mem_div_iff_smul_subset\n\ntheorem le_div_iff {I J K : Submodule R A} : I ≤ J / K ↔ ∀ x ∈ I, ∀ z ∈ K, x * z ∈ J :=\n Iff.refl _\n#align submodule.le_div_iff Submodule.le_div_iff\n\ntheorem le_div_iff_mul_le {I J K : Submodule R A} : I ≤ J / K ↔ I * K ≤ J := by\n rw [le_div_iff]\n rw [mul_le]\n#align submodule.le_div_iff_mul_le Submodule.le_div_iff_mul_le\n\n@[simp]\ntheorem one_le_one_div {I : Submodule R A} : 1 ≤ 1 / I ↔ I ≤ 1 := by\n constructor; all_goals intro hI\n · rwa [le_div_iff_mul_le, one_mul] at hI\n · rwa [le_div_iff_mul_le, one_mul]\n#align submodule.one_le_one_div Submodule.one_le_one_div\n\ntheorem le_self_mul_one_div {I : Submodule R A} (hI : I ≤ 1) : I ≤ I * (1 / I) := by\n refine (mul_one I).symm.trans_le ?_ -- porting note: drop `rw {occs := _}` in favor of `refine`\n apply mul_le_mul_right (one_le_one_div.mpr hI)\n#align submodule.le_self_mul_one_div Submodule.le_self_mul_one_div\n\ntheorem mul_one_div_le_one {I : Submodule R A} : I * (1 / I) ≤ 1 := by\n rw [Submodule.mul_le]\n intro m hm n hn\n rw [Submodule.mem_div_iff_forall_mul_mem] at hn\n rw [mul_comm]\n exact hn m hm\n#align submodule.mul_one_div_le_one Submodule.mul_one_div_le_one\n\n@[simp]\nprotected theorem map_div {B : Type*} [CommSemiring B] [Algebra R B] (I J : Submodule R A)\n (h : A ≃ₐ[R] B) : (I / J).map h.toLinearMap = I.map h.toLinearMap / J.map h.toLinearMap := by\n ext x\n simp only [mem_map, mem_div_iff_forall_mul_mem]\n constructor\n · rintro ⟨x, hx, rfl⟩ _ ⟨y, hy, rfl⟩\n ","nextTactic":"exact ⟨x * y, hx _ hy, h.map_mul x y⟩","declUpToTactic":"@[simp]\nprotected theorem map_div {B : Type*} [CommSemiring B] [Algebra R B] (I J : Submodule R A)\n (h : A ≃ₐ[R] B) : (I / J).map h.toLinearMap = I.map h.toLinearMap / J.map h.toLinearMap := by\n ext x\n simp only [mem_map, mem_div_iff_forall_mul_mem]\n constructor\n · rintro ⟨x, hx, rfl⟩ _ ⟨y, hy, rfl⟩\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.768_0.IvhXmXo9kppbroj","decl":"@[simp]\nprotected theorem map_div {B : Type*} [CommSemiring B] [Algebra R B] (I J : Submodule R A)\n (h : A ≃ₐ[R] B) : (I / J).map h.toLinearMap = I.map h.toLinearMap / J.map h.toLinearMap "} +{"state":"case h.mpr\nι : Sort uι\nR : Type u\ninst✝⁴ : CommSemiring R\nA : Type v\ninst✝³ : CommSemiring A\ninst✝² : Algebra R A\nM N : Submodule R A\nm n : A\nB : Type u_1\ninst✝¹ : CommSemiring B\ninst✝ : Algebra R B\nI J : Submodule R A\nh : A ≃ₐ[R] B\nx : B\n⊢ (∀ (y : B), (∃ y_1 ∈ J, (AlgEquiv.toLinearMap h) y_1 = y) → ∃ y_1 ∈ I, (AlgEquiv.toLinearMap h) y_1 = x * y) →\n ∃ y, (∀ y_1 ∈ J, y * y_1 ∈ I) ∧ (AlgEquiv.toLinearMap h) y = x","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n exact subset_span ⟨a, m, Set.mem_singleton a, hm, rfl⟩\n#align submodule.smul_singleton Submodule.smul_singleton\n\nsection Quotient\n\n/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n rw [add_mul]\n exact Submodule.add_mem _ (ha _ hy) (hb _ hy)\n smul_mem' := fun r x hx y hy => by\n rw [Algebra.smul_mul_assoc]\n exact Submodule.smul_mem _ _ (hx _ hy) }⟩\n\ntheorem mem_div_iff_forall_mul_mem {x : A} {I J : Submodule R A} : x ∈ I / J ↔ ∀ y ∈ J, x * y ∈ I :=\n Iff.refl _\n#align submodule.mem_div_iff_forall_mul_mem Submodule.mem_div_iff_forall_mul_mem\n\ntheorem mem_div_iff_smul_subset {x : A} {I J : Submodule R A} : x ∈ I / J ↔ x • (J : Set A) ⊆ I :=\n ⟨fun h y ⟨y', hy', xy'_eq_y⟩ => by\n rw [← xy'_eq_y]\n apply h\n assumption, fun h y hy => h (Set.smul_mem_smul_set hy)⟩\n#align submodule.mem_div_iff_smul_subset Submodule.mem_div_iff_smul_subset\n\ntheorem le_div_iff {I J K : Submodule R A} : I ≤ J / K ↔ ∀ x ∈ I, ∀ z ∈ K, x * z ∈ J :=\n Iff.refl _\n#align submodule.le_div_iff Submodule.le_div_iff\n\ntheorem le_div_iff_mul_le {I J K : Submodule R A} : I ≤ J / K ↔ I * K ≤ J := by\n rw [le_div_iff]\n rw [mul_le]\n#align submodule.le_div_iff_mul_le Submodule.le_div_iff_mul_le\n\n@[simp]\ntheorem one_le_one_div {I : Submodule R A} : 1 ≤ 1 / I ↔ I ≤ 1 := by\n constructor; all_goals intro hI\n · rwa [le_div_iff_mul_le, one_mul] at hI\n · rwa [le_div_iff_mul_le, one_mul]\n#align submodule.one_le_one_div Submodule.one_le_one_div\n\ntheorem le_self_mul_one_div {I : Submodule R A} (hI : I ≤ 1) : I ≤ I * (1 / I) := by\n refine (mul_one I).symm.trans_le ?_ -- porting note: drop `rw {occs := _}` in favor of `refine`\n apply mul_le_mul_right (one_le_one_div.mpr hI)\n#align submodule.le_self_mul_one_div Submodule.le_self_mul_one_div\n\ntheorem mul_one_div_le_one {I : Submodule R A} : I * (1 / I) ≤ 1 := by\n rw [Submodule.mul_le]\n intro m hm n hn\n rw [Submodule.mem_div_iff_forall_mul_mem] at hn\n rw [mul_comm]\n exact hn m hm\n#align submodule.mul_one_div_le_one Submodule.mul_one_div_le_one\n\n@[simp]\nprotected theorem map_div {B : Type*} [CommSemiring B] [Algebra R B] (I J : Submodule R A)\n (h : A ≃ₐ[R] B) : (I / J).map h.toLinearMap = I.map h.toLinearMap / J.map h.toLinearMap := by\n ext x\n simp only [mem_map, mem_div_iff_forall_mul_mem]\n constructor\n · rintro ⟨x, hx, rfl⟩ _ ⟨y, hy, rfl⟩\n exact ⟨x * y, hx _ hy, h.map_mul x y⟩\n · ","nextTactic":"rintro hx","declUpToTactic":"@[simp]\nprotected theorem map_div {B : Type*} [CommSemiring B] [Algebra R B] (I J : Submodule R A)\n (h : A ≃ₐ[R] B) : (I / J).map h.toLinearMap = I.map h.toLinearMap / J.map h.toLinearMap := by\n ext x\n simp only [mem_map, mem_div_iff_forall_mul_mem]\n constructor\n · rintro ⟨x, hx, rfl⟩ _ ⟨y, hy, rfl⟩\n exact ⟨x * y, hx _ hy, h.map_mul x y⟩\n · ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.768_0.IvhXmXo9kppbroj","decl":"@[simp]\nprotected theorem map_div {B : Type*} [CommSemiring B] [Algebra R B] (I J : Submodule R A)\n (h : A ≃ₐ[R] B) : (I / J).map h.toLinearMap = I.map h.toLinearMap / J.map h.toLinearMap "} +{"state":"case h.mpr\nι : Sort uι\nR : Type u\ninst✝⁴ : CommSemiring R\nA : Type v\ninst✝³ : CommSemiring A\ninst✝² : Algebra R A\nM N : Submodule R A\nm n : A\nB : Type u_1\ninst✝¹ : CommSemiring B\ninst✝ : Algebra R B\nI J : Submodule R A\nh : A ≃ₐ[R] B\nx : B\nhx : ∀ (y : B), (∃ y_1 ∈ J, (AlgEquiv.toLinearMap h) y_1 = y) → ∃ y_1 ∈ I, (AlgEquiv.toLinearMap h) y_1 = x * y\n⊢ ∃ y, (∀ y_1 ∈ J, y * y_1 ∈ I) ∧ (AlgEquiv.toLinearMap h) y = x","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ��ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n exact subset_span ⟨a, m, Set.mem_singleton a, hm, rfl⟩\n#align submodule.smul_singleton Submodule.smul_singleton\n\nsection Quotient\n\n/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n rw [add_mul]\n exact Submodule.add_mem _ (ha _ hy) (hb _ hy)\n smul_mem' := fun r x hx y hy => by\n rw [Algebra.smul_mul_assoc]\n exact Submodule.smul_mem _ _ (hx _ hy) }⟩\n\ntheorem mem_div_iff_forall_mul_mem {x : A} {I J : Submodule R A} : x ∈ I / J ↔ ∀ y ∈ J, x * y ∈ I :=\n Iff.refl _\n#align submodule.mem_div_iff_forall_mul_mem Submodule.mem_div_iff_forall_mul_mem\n\ntheorem mem_div_iff_smul_subset {x : A} {I J : Submodule R A} : x ∈ I / J ↔ x • (J : Set A) ⊆ I :=\n ⟨fun h y ⟨y', hy', xy'_eq_y⟩ => by\n rw [← xy'_eq_y]\n apply h\n assumption, fun h y hy => h (Set.smul_mem_smul_set hy)⟩\n#align submodule.mem_div_iff_smul_subset Submodule.mem_div_iff_smul_subset\n\ntheorem le_div_iff {I J K : Submodule R A} : I ≤ J / K ↔ ∀ x ∈ I, ∀ z ∈ K, x * z ∈ J :=\n Iff.refl _\n#align submodule.le_div_iff Submodule.le_div_iff\n\ntheorem le_div_iff_mul_le {I J K : Submodule R A} : I ≤ J / K ↔ I * K ≤ J := by\n rw [le_div_iff]\n rw [mul_le]\n#align submodule.le_div_iff_mul_le Submodule.le_div_iff_mul_le\n\n@[simp]\ntheorem one_le_one_div {I : Submodule R A} : 1 ≤ 1 / I ↔ I ≤ 1 := by\n constructor; all_goals intro hI\n · rwa [le_div_iff_mul_le, one_mul] at hI\n · rwa [le_div_iff_mul_le, one_mul]\n#align submodule.one_le_one_div Submodule.one_le_one_div\n\ntheorem le_self_mul_one_div {I : Submodule R A} (hI : I ≤ 1) : I ≤ I * (1 / I) := by\n refine (mul_one I).symm.trans_le ?_ -- porting note: drop `rw {occs := _}` in favor of `refine`\n apply mul_le_mul_right (one_le_one_div.mpr hI)\n#align submodule.le_self_mul_one_div Submodule.le_self_mul_one_div\n\ntheorem mul_one_div_le_one {I : Submodule R A} : I * (1 / I) ≤ 1 := by\n rw [Submodule.mul_le]\n intro m hm n hn\n rw [Submodule.mem_div_iff_forall_mul_mem] at hn\n rw [mul_comm]\n exact hn m hm\n#align submodule.mul_one_div_le_one Submodule.mul_one_div_le_one\n\n@[simp]\nprotected theorem map_div {B : Type*} [CommSemiring B] [Algebra R B] (I J : Submodule R A)\n (h : A ≃ₐ[R] B) : (I / J).map h.toLinearMap = I.map h.toLinearMap / J.map h.toLinearMap := by\n ext x\n simp only [mem_map, mem_div_iff_forall_mul_mem]\n constructor\n · rintro ⟨x, hx, rfl⟩ _ ⟨y, hy, rfl⟩\n exact ⟨x * y, hx _ hy, h.map_mul x y⟩\n · rintro hx\n ","nextTactic":"refine' ⟨h.symm x, fun z hz => _, h.apply_symm_apply x⟩","declUpToTactic":"@[simp]\nprotected theorem map_div {B : Type*} [CommSemiring B] [Algebra R B] (I J : Submodule R A)\n (h : A ≃ₐ[R] B) : (I / J).map h.toLinearMap = I.map h.toLinearMap / J.map h.toLinearMap := by\n ext x\n simp only [mem_map, mem_div_iff_forall_mul_mem]\n constructor\n · rintro ⟨x, hx, rfl⟩ _ ⟨y, hy, rfl⟩\n exact ⟨x * y, hx _ hy, h.map_mul x y⟩\n · rintro hx\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.768_0.IvhXmXo9kppbroj","decl":"@[simp]\nprotected theorem map_div {B : Type*} [CommSemiring B] [Algebra R B] (I J : Submodule R A)\n (h : A ≃ₐ[R] B) : (I / J).map h.toLinearMap = I.map h.toLinearMap / J.map h.toLinearMap "} +{"state":"case h.mpr\nι : Sort uι\nR : Type u\ninst✝⁴ : CommSemiring R\nA : Type v\ninst✝³ : CommSemiring A\ninst✝² : Algebra R A\nM N : Submodule R A\nm n : A\nB : Type u_1\ninst✝¹ : CommSemiring B\ninst✝ : Algebra R B\nI J : Submodule R A\nh : A ≃ₐ[R] B\nx : B\nhx : ∀ (y : B), (∃ y_1 ∈ J, (AlgEquiv.toLinearMap h) y_1 = y) → ∃ y_1 ∈ I, (AlgEquiv.toLinearMap h) y_1 = x * y\nz : A\nhz : z ∈ J\n⊢ (AlgEquiv.symm h) x * z ∈ I","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n exact subset_span ⟨a, m, Set.mem_singleton a, hm, rfl⟩\n#align submodule.smul_singleton Submodule.smul_singleton\n\nsection Quotient\n\n/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n rw [add_mul]\n exact Submodule.add_mem _ (ha _ hy) (hb _ hy)\n smul_mem' := fun r x hx y hy => by\n rw [Algebra.smul_mul_assoc]\n exact Submodule.smul_mem _ _ (hx _ hy) }⟩\n\ntheorem mem_div_iff_forall_mul_mem {x : A} {I J : Submodule R A} : x ∈ I / J ↔ ∀ y ∈ J, x * y ∈ I :=\n Iff.refl _\n#align submodule.mem_div_iff_forall_mul_mem Submodule.mem_div_iff_forall_mul_mem\n\ntheorem mem_div_iff_smul_subset {x : A} {I J : Submodule R A} : x ∈ I / J ↔ x • (J : Set A) ⊆ I :=\n ⟨fun h y ⟨y', hy', xy'_eq_y⟩ => by\n rw [← xy'_eq_y]\n apply h\n assumption, fun h y hy => h (Set.smul_mem_smul_set hy)⟩\n#align submodule.mem_div_iff_smul_subset Submodule.mem_div_iff_smul_subset\n\ntheorem le_div_iff {I J K : Submodule R A} : I ≤ J / K ↔ ∀ x ∈ I, ∀ z ∈ K, x * z ∈ J :=\n Iff.refl _\n#align submodule.le_div_iff Submodule.le_div_iff\n\ntheorem le_div_iff_mul_le {I J K : Submodule R A} : I ≤ J / K ↔ I * K ≤ J := by\n rw [le_div_iff]\n rw [mul_le]\n#align submodule.le_div_iff_mul_le Submodule.le_div_iff_mul_le\n\n@[simp]\ntheorem one_le_one_div {I : Submodule R A} : 1 ≤ 1 / I ↔ I ≤ 1 := by\n constructor; all_goals intro hI\n · rwa [le_div_iff_mul_le, one_mul] at hI\n · rwa [le_div_iff_mul_le, one_mul]\n#align submodule.one_le_one_div Submodule.one_le_one_div\n\ntheorem le_self_mul_one_div {I : Submodule R A} (hI : I ≤ 1) : I ≤ I * (1 / I) := by\n refine (mul_one I).symm.trans_le ?_ -- porting note: drop `rw {occs := _}` in favor of `refine`\n apply mul_le_mul_right (one_le_one_div.mpr hI)\n#align submodule.le_self_mul_one_div Submodule.le_self_mul_one_div\n\ntheorem mul_one_div_le_one {I : Submodule R A} : I * (1 / I) ≤ 1 := by\n rw [Submodule.mul_le]\n intro m hm n hn\n rw [Submodule.mem_div_iff_forall_mul_mem] at hn\n rw [mul_comm]\n exact hn m hm\n#align submodule.mul_one_div_le_one Submodule.mul_one_div_le_one\n\n@[simp]\nprotected theorem map_div {B : Type*} [CommSemiring B] [Algebra R B] (I J : Submodule R A)\n (h : A ≃ₐ[R] B) : (I / J).map h.toLinearMap = I.map h.toLinearMap / J.map h.toLinearMap := by\n ext x\n simp only [mem_map, mem_div_iff_forall_mul_mem]\n constructor\n · rintro ⟨x, hx, rfl⟩ _ ⟨y, hy, rfl⟩\n exact ⟨x * y, hx _ hy, h.map_mul x y⟩\n · rintro hx\n refine' ⟨h.symm x, fun z hz => _, h.apply_symm_apply x⟩\n ","nextTactic":"obtain ⟨xz, xz_mem, hxz⟩ := hx (h z) ⟨z, hz, rfl⟩","declUpToTactic":"@[simp]\nprotected theorem map_div {B : Type*} [CommSemiring B] [Algebra R B] (I J : Submodule R A)\n (h : A ≃ₐ[R] B) : (I / J).map h.toLinearMap = I.map h.toLinearMap / J.map h.toLinearMap := by\n ext x\n simp only [mem_map, mem_div_iff_forall_mul_mem]\n constructor\n · rintro ⟨x, hx, rfl⟩ _ ⟨y, hy, rfl⟩\n exact ⟨x * y, hx _ hy, h.map_mul x y⟩\n · rintro hx\n refine' ⟨h.symm x, fun z hz => _, h.apply_symm_apply x⟩\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.768_0.IvhXmXo9kppbroj","decl":"@[simp]\nprotected theorem map_div {B : Type*} [CommSemiring B] [Algebra R B] (I J : Submodule R A)\n (h : A ≃ₐ[R] B) : (I / J).map h.toLinearMap = I.map h.toLinearMap / J.map h.toLinearMap "} +{"state":"case h.mpr.intro.intro\nι : Sort uι\nR : Type u\ninst✝⁴ : CommSemiring R\nA : Type v\ninst✝³ : CommSemiring A\ninst✝² : Algebra R A\nM N : Submodule R A\nm n : A\nB : Type u_1\ninst✝¹ : CommSemiring B\ninst✝ : Algebra R B\nI J : Submodule R A\nh : A ≃ₐ[R] B\nx : B\nhx : ∀ (y : B), (∃ y_1 ∈ J, (AlgEquiv.toLinearMap h) y_1 = y) → ∃ y_1 ∈ I, (AlgEquiv.toLinearMap h) y_1 = x * y\nz : A\nhz : z ∈ J\nxz : A\nxz_mem : xz ∈ I\nhxz : (AlgEquiv.toLinearMap h) xz = x * h z\n⊢ (AlgEquiv.symm h) x * z ∈ I","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n exact subset_span ⟨a, m, Set.mem_singleton a, hm, rfl⟩\n#align submodule.smul_singleton Submodule.smul_singleton\n\nsection Quotient\n\n/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n rw [add_mul]\n exact Submodule.add_mem _ (ha _ hy) (hb _ hy)\n smul_mem' := fun r x hx y hy => by\n rw [Algebra.smul_mul_assoc]\n exact Submodule.smul_mem _ _ (hx _ hy) }⟩\n\ntheorem mem_div_iff_forall_mul_mem {x : A} {I J : Submodule R A} : x ∈ I / J ↔ ∀ y ∈ J, x * y ∈ I :=\n Iff.refl _\n#align submodule.mem_div_iff_forall_mul_mem Submodule.mem_div_iff_forall_mul_mem\n\ntheorem mem_div_iff_smul_subset {x : A} {I J : Submodule R A} : x ∈ I / J ↔ x • (J : Set A) ⊆ I :=\n ⟨fun h y ⟨y', hy', xy'_eq_y⟩ => by\n rw [← xy'_eq_y]\n apply h\n assumption, fun h y hy => h (Set.smul_mem_smul_set hy)⟩\n#align submodule.mem_div_iff_smul_subset Submodule.mem_div_iff_smul_subset\n\ntheorem le_div_iff {I J K : Submodule R A} : I ≤ J / K ↔ ∀ x ∈ I, ∀ z ∈ K, x * z ∈ J :=\n Iff.refl _\n#align submodule.le_div_iff Submodule.le_div_iff\n\ntheorem le_div_iff_mul_le {I J K : Submodule R A} : I ≤ J / K ↔ I * K ≤ J := by\n rw [le_div_iff]\n rw [mul_le]\n#align submodule.le_div_iff_mul_le Submodule.le_div_iff_mul_le\n\n@[simp]\ntheorem one_le_one_div {I : Submodule R A} : 1 ≤ 1 / I ↔ I ≤ 1 := by\n constructor; all_goals intro hI\n · rwa [le_div_iff_mul_le, one_mul] at hI\n · rwa [le_div_iff_mul_le, one_mul]\n#align submodule.one_le_one_div Submodule.one_le_one_div\n\ntheorem le_self_mul_one_div {I : Submodule R A} (hI : I ≤ 1) : I ≤ I * (1 / I) := by\n refine (mul_one I).symm.trans_le ?_ -- porting note: drop `rw {occs := _}` in favor of `refine`\n apply mul_le_mul_right (one_le_one_div.mpr hI)\n#align submodule.le_self_mul_one_div Submodule.le_self_mul_one_div\n\ntheorem mul_one_div_le_one {I : Submodule R A} : I * (1 / I) ≤ 1 := by\n rw [Submodule.mul_le]\n intro m hm n hn\n rw [Submodule.mem_div_iff_forall_mul_mem] at hn\n rw [mul_comm]\n exact hn m hm\n#align submodule.mul_one_div_le_one Submodule.mul_one_div_le_one\n\n@[simp]\nprotected theorem map_div {B : Type*} [CommSemiring B] [Algebra R B] (I J : Submodule R A)\n (h : A ≃ₐ[R] B) : (I / J).map h.toLinearMap = I.map h.toLinearMap / J.map h.toLinearMap := by\n ext x\n simp only [mem_map, mem_div_iff_forall_mul_mem]\n constructor\n · rintro ⟨x, hx, rfl⟩ _ ⟨y, hy, rfl⟩\n exact ⟨x * y, hx _ hy, h.map_mul x y⟩\n · rintro hx\n refine' ⟨h.symm x, fun z hz => _, h.apply_symm_apply x⟩\n obtain ⟨xz, xz_mem, hxz⟩ := hx (h z) ⟨z, hz, rfl⟩\n ","nextTactic":"convert xz_mem","declUpToTactic":"@[simp]\nprotected theorem map_div {B : Type*} [CommSemiring B] [Algebra R B] (I J : Submodule R A)\n (h : A ≃ₐ[R] B) : (I / J).map h.toLinearMap = I.map h.toLinearMap / J.map h.toLinearMap := by\n ext x\n simp only [mem_map, mem_div_iff_forall_mul_mem]\n constructor\n · rintro ⟨x, hx, rfl⟩ _ ⟨y, hy, rfl⟩\n exact ⟨x * y, hx _ hy, h.map_mul x y⟩\n · rintro hx\n refine' ⟨h.symm x, fun z hz => _, h.apply_symm_apply x⟩\n obtain ⟨xz, xz_mem, hxz⟩ := hx (h z) ⟨z, hz, rfl⟩\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.768_0.IvhXmXo9kppbroj","decl":"@[simp]\nprotected theorem map_div {B : Type*} [CommSemiring B] [Algebra R B] (I J : Submodule R A)\n (h : A ≃ₐ[R] B) : (I / J).map h.toLinearMap = I.map h.toLinearMap / J.map h.toLinearMap "} +{"state":"case h.e'_4\nι : Sort uι\nR : Type u\ninst✝⁴ : CommSemiring R\nA : Type v\ninst✝³ : CommSemiring A\ninst✝² : Algebra R A\nM N : Submodule R A\nm n : A\nB : Type u_1\ninst✝¹ : CommSemiring B\ninst✝ : Algebra R B\nI J : Submodule R A\nh : A ≃ₐ[R] B\nx : B\nhx : ∀ (y : B), (∃ y_1 ∈ J, (AlgEquiv.toLinearMap h) y_1 = y) → ∃ y_1 ∈ I, (AlgEquiv.toLinearMap h) y_1 = x * y\nz : A\nhz : z ∈ J\nxz : A\nxz_mem : xz ∈ I\nhxz : (AlgEquiv.toLinearMap h) xz = x * h z\n⊢ (AlgEquiv.symm h) x * z = xz","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →��[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (���(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n exact subset_span ⟨a, m, Set.mem_singleton a, hm, rfl⟩\n#align submodule.smul_singleton Submodule.smul_singleton\n\nsection Quotient\n\n/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n rw [add_mul]\n exact Submodule.add_mem _ (ha _ hy) (hb _ hy)\n smul_mem' := fun r x hx y hy => by\n rw [Algebra.smul_mul_assoc]\n exact Submodule.smul_mem _ _ (hx _ hy) }⟩\n\ntheorem mem_div_iff_forall_mul_mem {x : A} {I J : Submodule R A} : x ∈ I / J ↔ ∀ y ∈ J, x * y ∈ I :=\n Iff.refl _\n#align submodule.mem_div_iff_forall_mul_mem Submodule.mem_div_iff_forall_mul_mem\n\ntheorem mem_div_iff_smul_subset {x : A} {I J : Submodule R A} : x ∈ I / J ↔ x • (J : Set A) ⊆ I :=\n ⟨fun h y ⟨y', hy', xy'_eq_y⟩ => by\n rw [← xy'_eq_y]\n apply h\n assumption, fun h y hy => h (Set.smul_mem_smul_set hy)⟩\n#align submodule.mem_div_iff_smul_subset Submodule.mem_div_iff_smul_subset\n\ntheorem le_div_iff {I J K : Submodule R A} : I ≤ J / K ↔ ∀ x ∈ I, ∀ z ∈ K, x * z ∈ J :=\n Iff.refl _\n#align submodule.le_div_iff Submodule.le_div_iff\n\ntheorem le_div_iff_mul_le {I J K : Submodule R A} : I ≤ J / K ↔ I * K ≤ J := by\n rw [le_div_iff]\n rw [mul_le]\n#align submodule.le_div_iff_mul_le Submodule.le_div_iff_mul_le\n\n@[simp]\ntheorem one_le_one_div {I : Submodule R A} : 1 ≤ 1 / I ↔ I ≤ 1 := by\n constructor; all_goals intro hI\n · rwa [le_div_iff_mul_le, one_mul] at hI\n · rwa [le_div_iff_mul_le, one_mul]\n#align submodule.one_le_one_div Submodule.one_le_one_div\n\ntheorem le_self_mul_one_div {I : Submodule R A} (hI : I ≤ 1) : I ≤ I * (1 / I) := by\n refine (mul_one I).symm.trans_le ?_ -- porting note: drop `rw {occs := _}` in favor of `refine`\n apply mul_le_mul_right (one_le_one_div.mpr hI)\n#align submodule.le_self_mul_one_div Submodule.le_self_mul_one_div\n\ntheorem mul_one_div_le_one {I : Submodule R A} : I * (1 / I) ≤ 1 := by\n rw [Submodule.mul_le]\n intro m hm n hn\n rw [Submodule.mem_div_iff_forall_mul_mem] at hn\n rw [mul_comm]\n exact hn m hm\n#align submodule.mul_one_div_le_one Submodule.mul_one_div_le_one\n\n@[simp]\nprotected theorem map_div {B : Type*} [CommSemiring B] [Algebra R B] (I J : Submodule R A)\n (h : A ≃ₐ[R] B) : (I / J).map h.toLinearMap = I.map h.toLinearMap / J.map h.toLinearMap := by\n ext x\n simp only [mem_map, mem_div_iff_forall_mul_mem]\n constructor\n · rintro ⟨x, hx, rfl⟩ _ ⟨y, hy, rfl⟩\n exact ⟨x * y, hx _ hy, h.map_mul x y⟩\n · rintro hx\n refine' ⟨h.symm x, fun z hz => _, h.apply_symm_apply x⟩\n obtain ⟨xz, xz_mem, hxz⟩ := hx (h z) ⟨z, hz, rfl⟩\n convert xz_mem\n ","nextTactic":"apply h.injective","declUpToTactic":"@[simp]\nprotected theorem map_div {B : Type*} [CommSemiring B] [Algebra R B] (I J : Submodule R A)\n (h : A ≃ₐ[R] B) : (I / J).map h.toLinearMap = I.map h.toLinearMap / J.map h.toLinearMap := by\n ext x\n simp only [mem_map, mem_div_iff_forall_mul_mem]\n constructor\n · rintro ⟨x, hx, rfl⟩ _ ⟨y, hy, rfl⟩\n exact ⟨x * y, hx _ hy, h.map_mul x y⟩\n · rintro hx\n refine' ⟨h.symm x, fun z hz => _, h.apply_symm_apply x⟩\n obtain ⟨xz, xz_mem, hxz⟩ := hx (h z) ⟨z, hz, rfl⟩\n convert xz_mem\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.768_0.IvhXmXo9kppbroj","decl":"@[simp]\nprotected theorem map_div {B : Type*} [CommSemiring B] [Algebra R B] (I J : Submodule R A)\n (h : A ≃ₐ[R] B) : (I / J).map h.toLinearMap = I.map h.toLinearMap / J.map h.toLinearMap "} +{"state":"case h.e'_4.a\nι : Sort uι\nR : Type u\ninst✝⁴ : CommSemiring R\nA : Type v\ninst✝³ : CommSemiring A\ninst✝² : Algebra R A\nM N : Submodule R A\nm n : A\nB : Type u_1\ninst✝¹ : CommSemiring B\ninst✝ : Algebra R B\nI J : Submodule R A\nh : A ≃ₐ[R] B\nx : B\nhx : ∀ (y : B), (∃ y_1 ∈ J, (AlgEquiv.toLinearMap h) y_1 = y) → ∃ y_1 ∈ I, (AlgEquiv.toLinearMap h) y_1 = x * y\nz : A\nhz : z ∈ J\nxz : A\nxz_mem : xz ∈ I\nhxz : (AlgEquiv.toLinearMap h) xz = x * h z\n⊢ h ((AlgEquiv.symm h) x * z) = h xz","srcUpToTactic":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\nimport Mathlib.Algebra.Algebra.Bilinear\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Module.Submodule.Pointwise\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.Algebra.Module.Opposites\nimport Mathlib.Algebra.Order.Kleene\nimport Mathlib.Data.Finset.Pointwise\nimport Mathlib.Data.Set.Semiring\nimport Mathlib.Data.Set.Pointwise.BigOperators\nimport Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\n\n#align_import algebra.algebra.operations from \"leanprover-community/mathlib\"@\"27b54c47c3137250a521aa64e9f1db90be5f6a26\"\n\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `pointwise` locale we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen BigOperators\n\nopen Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n#align sub_mul_action.algebra_map_mem SubMulAction.algebraMap_mem\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n#align sub_mul_action.mem_one' SubMulAction.mem_one'\n\nend SubMulAction\n\nnamespace Submodule\n\nvariable {ι : Sort uι}\n\nvariable {R : Type u} [CommSemiring R]\n\nsection Ring\n\nvariable {A : Type v} [Semiring A] [Algebra R A]\n\nvariable (S T : Set A) {M N P Q : Submodule R A} {m n : A}\n\n/-- `1 : Submodule R A` is the submodule R of A. -/\ninstance one : One (Submodule R A) :=\n -- porting note: `f.range` notation doesn't work\n ⟨LinearMap.range (Algebra.linearMap R A)⟩\n#align submodule.has_one Submodule.one\n\ntheorem one_eq_range : (1 : Submodule R A) = LinearMap.range (Algebra.linearMap R A) :=\n rfl\n#align submodule.one_eq_range Submodule.one_eq_range\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, map_natCast (algebraMap R A) n⟩\n#align submodule.le_one_to_add_submonoid Submodule.le_one_toAddSubmonoid\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : Submodule R A) :=\n LinearMap.mem_range_self _ _\n#align submodule.algebra_map_mem Submodule.algebraMap_mem\n\n@[simp]\ntheorem mem_one {x : A} : x ∈ (1 : Submodule R A) ↔ ∃ y, algebraMap R A y = x :=\n Iff.rfl\n#align submodule.mem_one Submodule.mem_one\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ => mem_one.trans SubMulAction.mem_one'.symm\n#align submodule.to_sub_mul_action_one Submodule.toSubMulAction_one\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 := by\n apply Submodule.ext\n intro a\n simp only [mem_one, mem_span_singleton, Algebra.smul_def, mul_one]\n#align submodule.one_eq_span Submodule.one_eq_span\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n#align submodule.one_eq_span_one_set Submodule.one_eq_span_one_set\n\ntheorem one_le : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n -- porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`\n simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]\n#align submodule.one_le Submodule.one_le\n\nprotected theorem map_one {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (1 : Submodule R A) = 1 := by\n ext\n simp\n#align submodule.map_one Submodule.map_one\n\n@[simp]\ntheorem map_op_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R A) = 1 := by\n ext x\n induction x using MulOpposite.rec'\n simp\n#align submodule.map_op_one Submodule.map_op_one\n\n@[simp]\ntheorem comap_op_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n ext\n simp\n#align submodule.comap_op_one Submodule.comap_op_one\n\n@[simp]\ntheorem map_unop_one :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R Aᵐᵒᵖ) = 1 := by\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_one]\n#align submodule.map_unop_one Submodule.map_unop_one\n\n@[simp]\ntheorem comap_unop_one :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (1 : Submodule R A) = 1 := by\n rw [← map_equiv_eq_comap_symm]\n rw [map_op_one]\n#align submodule.comap_unop_one Submodule.comap_unop_one\n\n/-- Multiplication of sub-R-modules of an R-algebra A. The submodule `M * N` is the\nsmallest R-submodule of `A` containing the elements `m * n` for `m ∈ M` and `n ∈ N`. -/\ninstance mul : Mul (Submodule R A) :=\n ⟨Submodule.map₂ <| LinearMap.mul R A⟩\n#align submodule.has_mul Submodule.mul\n\ntheorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=\n apply_mem_map₂ _ hm hn\n#align submodule.mul_mem_mul Submodule.mul_mem_mul\n\ntheorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=\n map₂_le\n#align submodule.mul_le Submodule.mul_le\n\ntheorem mul_toAddSubmonoid (M N : Submodule R A) :\n (M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := by\n dsimp [HMul.hMul, Mul.mul] --porting note: added `hMul`\n rw [map₂]\n rw [iSup_toAddSubmonoid]\n rfl\n#align submodule.mul_to_add_submonoid Submodule.mul_toAddSubmonoid\n\n@[elab_as_elim]\nprotected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)\n (hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r := by\n rw [← mem_toAddSubmonoid] at hr\n rw [mul_toAddSubmonoid] at hr\n exact AddSubmonoid.mul_induction_on hr hm ha\n#align submodule.mul_induction_on Submodule.mul_induction_on\n\n/-- A dependent version of `mul_induction_on`. -/\n@[elab_as_elim]\nprotected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}\n (hm : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))\n (ha : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :\n C r hr := by\n refine' Exists.elim _ fun (hr : r ∈ M * N) (hc : C r hr) => hc\n exact\n Submodule.mul_induction_on hr (fun x hx y hy => ⟨_, hm _ hx _ hy⟩) fun x y ⟨_, hx⟩ ⟨_, hy⟩ =>\n ⟨_, ha _ _ _ _ hx hy⟩\n#align submodule.mul_induction_on' Submodule.mul_induction_on'\n\nvariable (R)\n\ntheorem span_mul_span : span R S * span R T = span R (S * T) :=\n map₂_span_span _ _ _ _\n#align submodule.span_mul_span Submodule.span_mul_span\n\nvariable {R}\n\nvariable (M N P Q)\n\n@[simp]\ntheorem mul_bot : M * ⊥ = ⊥ :=\n map₂_bot_right _ _\n#align submodule.mul_bot Submodule.mul_bot\n\n@[simp]\ntheorem bot_mul : ⊥ * M = ⊥ :=\n map₂_bot_left _ _\n#align submodule.bot_mul Submodule.bot_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem one_mul : (1 : Submodule R A) * M = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, one_mul, span_eq]\n#align submodule.one_mul Submodule.one_mul\n\n-- @[simp] -- Porting note: simp can prove this once we have a monoid structure\nprotected theorem mul_one : M * 1 = M := by\n conv_lhs => rw [one_eq_span, ← span_eq M]\n erw [span_mul_span, mul_one, span_eq]\n#align submodule.mul_one Submodule.mul_one\n\nvariable {M N P Q}\n\n@[mono]\ntheorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=\n map₂_le_map₂ hmp hnq\n#align submodule.mul_le_mul Submodule.mul_le_mul\n\ntheorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=\n map₂_le_map₂_left h\n#align submodule.mul_le_mul_left Submodule.mul_le_mul_left\n\ntheorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=\n map₂_le_map₂_right h\n#align submodule.mul_le_mul_right Submodule.mul_le_mul_right\n\nvariable (M N P)\n\ntheorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=\n map₂_sup_right _ _ _ _\n#align submodule.mul_sup Submodule.mul_sup\n\ntheorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=\n map₂_sup_left _ _ _ _\n#align submodule.sup_mul Submodule.sup_mul\n\ntheorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=\n image2_subset_map₂ (Algebra.lmul R A).toLinearMap M N\n#align submodule.mul_subset_mul Submodule.mul_subset_mul\n\nprotected theorem map_mul {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') :\n map f.toLinearMap (M * N) = map f.toLinearMap M * map f.toLinearMap N :=\n calc\n map f.toLinearMap (M * N) = ⨆ i : M, (N.map (LinearMap.mul R A i)).map f.toLinearMap :=\n map_iSup _ _\n _ = map f.toLinearMap M * map f.toLinearMap N := by\n apply congr_arg sSup\n ext S\n constructor <;> rintro ⟨y, hy⟩\n · use ⟨f y, mem_map.mpr ⟨y.1, y.2, rfl⟩⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n ext\n simp\n · obtain ⟨y', hy', fy_eq⟩ := mem_map.mp y.2\n use ⟨y', hy'⟩ -- porting note: added `⟨⟩`\n refine' Eq.trans _ hy\n rw [f.toLinearMap_apply] at fy_eq\n ext\n simp [fy_eq]\n#align submodule.map_mul Submodule.map_mul\n\ntheorem map_op_mul :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n apply le_antisymm\n · simp_rw [map_le_iff_le_comap]\n refine' mul_le.2 fun m hm n hn => _\n rw [mem_comap]\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n show op n * op m ∈ _\n exact mul_mem_mul hn hm\n · refine' mul_le.2 (MulOpposite.rec' fun m hm => MulOpposite.rec' fun n hn => _)\n rw [Submodule.mem_map_equiv] at hm hn ⊢\n exact mul_mem_mul hn hm\n#align submodule.map_op_mul Submodule.map_op_mul\n\ntheorem comap_unop_mul :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M := by\n simp_rw [← map_equiv_eq_comap_symm, map_op_mul]\n#align submodule.comap_unop_mul Submodule.comap_unop_mul\n\ntheorem map_unop_mul (M N : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M * N) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) N *\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M :=\n have : Function.Injective (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) :=\n LinearEquiv.injective _\n map_injective_of_injective this <| by\n rw [← map_comp, map_op_mul, ← map_comp, ← map_comp, LinearEquiv.comp_coe,\n LinearEquiv.symm_trans_self, LinearEquiv.refl_toLinearMap, map_id, map_id, map_id]\n#align submodule.map_unop_mul Submodule.map_unop_mul\n\ntheorem comap_op_mul (M N : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M * N) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) N *\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M := by\n simp_rw [comap_equiv_eq_map_symm, map_unop_mul]\n#align submodule.comap_op_mul Submodule.comap_op_mul\n\nlemma restrictScalars_mul {A B C} [CommSemiring A] [CommSemiring B] [Semiring C]\n [Algebra A B] [Algebra A C] [Algebra B C] [IsScalarTower A B C] {I J : Submodule B C} :\n (I * J).restrictScalars A = I.restrictScalars A * J.restrictScalars A := by\n apply le_antisymm\n · intro x (hx : x ∈ I * J)\n refine Submodule.mul_induction_on hx ?_ ?_\n · exact fun m hm n hn ↦ mul_mem_mul hm hn\n · exact fun _ _ ↦ add_mem\n · exact mul_le.mpr (fun _ hm _ hn ↦ mul_mem_mul hm hn)\n\nsection\n\nopen Pointwise\n\n/-- `Submodule.pointwiseNeg` distributes over multiplication.\n\nThis is available as an instance in the `Pointwise` locale. -/\nprotected def hasDistribPointwiseNeg {A} [Ring A] [Algebra R A] : HasDistribNeg (Submodule R A) :=\n toAddSubmonoid_injective.hasDistribNeg _ neg_toAddSubmonoid mul_toAddSubmonoid\n#align submodule.has_distrib_pointwise_neg Submodule.hasDistribPointwiseNeg\n\nscoped[Pointwise] attribute [instance] Submodule.hasDistribPointwiseNeg\n\nend\n\nsection DecidableEq\n\nopen Classical\n\ntheorem mem_span_mul_finite_of_mem_span_mul {R A} [Semiring R] [AddCommMonoid A] [Mul A]\n [Module R A] {S : Set A} {S' : Set A} {x : A} (hx : x ∈ span R (S * S')) :\n ∃ T T' : Finset A, ↑T ⊆ S ∧ ↑T' ⊆ S' ∧ x ∈ span R (T * T' : Set A) := by\n obtain ⟨U, h, hU⟩ := mem_span_finite_of_mem_span hx\n obtain ⟨T, T', hS, hS', h⟩ := Finset.subset_mul h\n use T, T', hS, hS'\n have h' : (U : Set A) ⊆ T * T' := by assumption_mod_cast\n have h'' := span_mono h' hU\n assumption\n#align submodule.mem_span_mul_finite_of_mem_span_mul Submodule.mem_span_mul_finite_of_mem_span_mul\n\nend DecidableEq\n\ntheorem mul_eq_span_mul_set (s t : Submodule R A) : s * t = span R ((s : Set A) * (t : Set A)) :=\n map₂_eq_span_image2 _ s t\n#align submodule.mul_eq_span_mul_set Submodule.mul_eq_span_mul_set\n\ntheorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=\n map₂_iSup_left _ s t\n#align submodule.supr_mul Submodule.iSup_mul\n\ntheorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=\n map₂_iSup_right _ t s\n#align submodule.mul_supr Submodule.mul_iSup\n\ntheorem mem_span_mul_finite_of_mem_mul {P Q : Submodule R A} {x : A} (hx : x ∈ P * Q) :\n ∃ T T' : Finset A, (T : Set A) ⊆ P ∧ (T' : Set A) ⊆ Q ∧ x ∈ span R (T * T' : Set A) :=\n Submodule.mem_span_mul_finite_of_mem_span_mul\n (by rwa [← Submodule.span_eq P, ← Submodule.span_eq Q, Submodule.span_mul_span] at hx)\n#align submodule.mem_span_mul_finite_of_mem_mul Submodule.mem_span_mul_finite_of_mem_mul\n\nvariable {M N P}\n\ntheorem mem_span_singleton_mul {x y : A} : x ∈ span R {y} * P ↔ ∃ z ∈ P, y * z = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map]\n rfl\n#align submodule.mem_span_singleton_mul Submodule.mem_span_singleton_mul\n\ntheorem mem_mul_span_singleton {x y : A} : x ∈ P * span R {y} ↔ ∃ z ∈ P, z * y = x := by\n --porting note: need both `*` and `Mul.mul`\n simp_rw [(· * ·), Mul.mul, map₂_span_singleton_eq_map_flip]\n rfl\n#align submodule.mem_mul_span_singleton Submodule.mem_mul_span_singleton\n\nlemma span_singleton_mul {x : A} {p : Submodule R A} :\n Submodule.span R {x} * p = x • p := ext fun _ ↦ mem_span_singleton_mul\n\nlemma mem_smul_iff_inv_mul_mem {S} [Field S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ≠ 0) : y ∈ x • p ↔ x⁻¹ * y ∈ p := by\n constructor\n · rintro ⟨a, ha : a ∈ p, rfl⟩; simpa [inv_mul_cancel_left₀ hx]\n · exact fun h ↦ ⟨_, h, by simp [mul_inv_cancel_left₀ hx]⟩\n\nlemma mul_mem_smul_iff {S} [CommRing S] [Algebra R S] {x : S} {p : Submodule R S} {y : S}\n (hx : x ∈ nonZeroDivisors S) :\n x * y ∈ x • p ↔ y ∈ p :=\n show Exists _ ↔ _ by simp [mul_cancel_left_mem_nonZeroDivisors hx]\n\n/-- Sub-R-modules of an R-algebra form an idempotent semiring. -/\ninstance idemSemiring : IdemSemiring (Submodule R A) :=\n { toAddSubmonoid_injective.semigroup _ fun m n : Submodule R A => mul_toAddSubmonoid m n,\n AddMonoidWithOne.unary, Submodule.pointwiseAddCommMonoid,\n (by infer_instance :\n Lattice (Submodule R A)) with\n one_mul := Submodule.one_mul\n mul_one := Submodule.mul_one\n zero_mul := bot_mul\n mul_zero := mul_bot\n left_distrib := mul_sup\n right_distrib := sup_mul,\n -- porting note: removed `(by infer_instance : OrderBot (Submodule R A))`\n bot_le := fun _ => bot_le }\n\nvariable (M)\n\ntheorem span_pow (s : Set A) : ∀ n : ℕ, span R s ^ n = span R (s ^ n)\n | 0 => by rw [pow_zero, pow_zero, one_eq_span_one_set]\n | n + 1 => by rw [pow_succ, pow_succ, span_pow s n, span_mul_span]\n#align submodule.span_pow Submodule.span_pow\n\ntheorem pow_eq_span_pow_set (n : ℕ) : M ^ n = span R ((M : Set A) ^ n) := by\n rw [← span_pow]\n rw [span_eq]\n#align submodule.pow_eq_span_pow_set Submodule.pow_eq_span_pow_set\n\ntheorem pow_subset_pow {n : ℕ} : (↑M : Set A) ^ n ⊆ ↑(M ^ n : Submodule R A) :=\n (pow_eq_span_pow_set M n).symm ▸ subset_span\n#align submodule.pow_subset_pow Submodule.pow_subset_pow\n\ntheorem pow_mem_pow {x : A} (hx : x ∈ M) (n : ℕ) : x ^ n ∈ M ^ n :=\n pow_subset_pow _ <| Set.pow_mem_pow hx _\n#align submodule.pow_mem_pow Submodule.pow_mem_pow\n\ntheorem pow_toAddSubmonoid {n : ℕ} (h : n ≠ 0) : (M ^ n).toAddSubmonoid = M.toAddSubmonoid ^ n := by\n induction' n with n ih\n · exact (h rfl).elim\n · rw [pow_succ, pow_succ, mul_toAddSubmonoid]\n cases n with\n | zero => rw [pow_zero, pow_zero, mul_one, ← mul_toAddSubmonoid, mul_one]\n | succ n => rw [ih n.succ_ne_zero]\n#align submodule.pow_to_add_submonoid Submodule.pow_toAddSubmonoid\n\ntheorem le_pow_toAddSubmonoid {n : ℕ} : M.toAddSubmonoid ^ n ≤ (M ^ n).toAddSubmonoid := by\n obtain rfl | hn := Decidable.eq_or_ne n 0\n · rw [pow_zero, pow_zero]\n exact le_one_toAddSubmonoid\n · exact (pow_toAddSubmonoid M hn).ge\n#align submodule.le_pow_to_add_submonoid Submodule.le_pow_toAddSubmonoid\n\n/-- Dependent version of `Submodule.pow_induction_on_left`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul : ∀ m (hm : m ∈ M), ∀ (i x hx), C i x hx → C i.succ (m * x) (mul_mem_mul hm hx))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A}\n (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ hm _ _ _ (n_ih ih))\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_left' Submodule.pow_induction_on_left'\n\n/-- Dependent version of `Submodule.pow_induction_on_right`. -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right' {C : ∀ (n : ℕ) (x), x ∈ M ^ n → Prop}\n (hr : ∀ r : R, C 0 (algebraMap _ _ r) (algebraMap_mem r))\n (hadd : ∀ x y i hx hy, C i x hx → C i y hy → C i (x + y) (add_mem ‹_› ‹_›))\n (hmul :\n ∀ i x hx, C i x hx →\n ∀ m (hm : m ∈ M), C i.succ (x * m) ((pow_succ' M i).symm ▸ mul_mem_mul hx hm))\n -- porting note: swapped argument order to match order of `C`\n {n : ℕ} {x : A} (hx : x ∈ M ^ n) : C n x hx := by\n induction' n with n n_ih generalizing x\n · rw [pow_zero] at hx\n obtain ⟨r, rfl⟩ := hx\n exact hr r\n revert hx\n simp_rw [pow_succ']\n intro hx\n exact\n Submodule.mul_induction_on' (fun m hm x ih => hmul _ _ hm (n_ih _) _ ih)\n (fun x hx y hy Cx Cy => hadd _ _ _ _ _ Cx Cy) hx\n#align submodule.pow_induction_on_right' Submodule.pow_induction_on_right'\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `m * x` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_left {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ m ∈ M, ∀ (x), C x → C (m * x)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n -- porting note: `M` is explicit yet can't be passed positionally!\n Submodule.pow_induction_on_left' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _m hm _i _x _hx => hmul _ hm _) hx\n#align submodule.pow_induction_on_left Submodule.pow_induction_on_left\n\n/-- To show a property on elements of `M ^ n` holds, it suffices to show that it holds for scalars,\nis closed under addition, and holds for `x * m` where `m ∈ M` and it holds for `x` -/\n@[elab_as_elim]\nprotected theorem pow_induction_on_right {C : A → Prop} (hr : ∀ r : R, C (algebraMap _ _ r))\n (hadd : ∀ x y, C x → C y → C (x + y)) (hmul : ∀ x, C x → ∀ m ∈ M, C (x * m)) {x : A} {n : ℕ}\n (hx : x ∈ M ^ n) : C x :=\n Submodule.pow_induction_on_right' (M := M) (C := fun _ a _ => C a) hr\n (fun x y _i _hx _hy => hadd x y)\n (fun _i _x _hx => hmul _) hx\n#align submodule.pow_induction_on_right Submodule.pow_induction_on_right\n\n/-- `Submonoid.map` as a `MonoidWithZeroHom`, when applied to `AlgHom`s. -/\n@[simps]\ndef mapHom {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') : Submodule R A →*₀ Submodule R A'\n where\n toFun := map f.toLinearMap\n map_zero' := Submodule.map_bot _\n map_one' := Submodule.map_one _\n map_mul' _ _ := Submodule.map_mul _ _ _\n#align submodule.map_hom Submodule.mapHom\n\n/-- The ring of submodules of the opposite algebra is isomorphic to the opposite ring of\nsubmodules. -/\n@[simps apply symm_apply]\ndef equivOpposite : Submodule R Aᵐᵒᵖ ≃+* (Submodule R A)ᵐᵒᵖ where\n toFun p := op <| p.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ)\n invFun p := p.unop.comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A)\n left_inv p := SetLike.coe_injective <| rfl\n right_inv p := unop_injective <| SetLike.coe_injective rfl\n map_add' p q := by simp [comap_equiv_eq_map_symm, ← op_add]\n map_mul' p q := congr_arg op <| comap_op_mul _ _\n#align submodule.equiv_opposite Submodule.equivOpposite\n\nprotected theorem map_pow {A'} [Semiring A'] [Algebra R A'] (f : A →ₐ[R] A') (n : ℕ) :\n map f.toLinearMap (M ^ n) = map f.toLinearMap M ^ n :=\n map_pow (mapHom f) M n\n#align submodule.map_pow Submodule.map_pow\n\ntheorem comap_unop_pow (n : ℕ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n :=\n (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).symm.map_pow (op M) n\n#align submodule.comap_unop_pow Submodule.comap_unop_pow\n\ntheorem comap_op_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n comap (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n :=\n op_injective <| (equivOpposite : Submodule R Aᵐᵒᵖ ≃+* _).map_pow M n\n#align submodule.comap_op_pow Submodule.comap_op_pow\n\ntheorem map_op_pow (n : ℕ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ) : A →ₗ[R] Aᵐᵒᵖ) M ^ n := by\n rw [map_equiv_eq_comap_symm]\n rw [map_equiv_eq_comap_symm]\n rw [comap_unop_pow]\n#align submodule.map_op_pow Submodule.map_op_pow\n\ntheorem map_unop_pow (n : ℕ) (M : Submodule R Aᵐᵒᵖ) :\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) (M ^ n) =\n map (↑(opLinearEquiv R : A ≃ₗ[R] Aᵐᵒᵖ).symm : Aᵐᵒᵖ →ₗ[R] A) M ^ n := by\n rw [← comap_equiv_eq_map_symm]\n rw [← comap_equiv_eq_map_symm]\n rw [comap_op_pow]\n#align submodule.map_unop_pow Submodule.map_unop_pow\n\n/-- `span` is a semiring homomorphism (recall multiplication is pointwise multiplication of subsets\non either side). -/\n@[simps]\ndef span.ringHom : SetSemiring A →+* Submodule R A where\n toFun s := Submodule.span R (SetSemiring.down s)\n map_zero' := span_empty\n map_one' := one_eq_span.symm\n map_add' := span_union\n map_mul' s t := by\n dsimp only -- porting note: new, needed due to new-style structures\n rw [SetSemiring.down_mul]\n rw [span_mul_span]\n rw [← image_mul_prod]\n#align submodule.span.ring_hom Submodule.span.ringHom\n\nsection\n\nvariable {α : Type*} [Monoid α] [MulSemiringAction α A] [SMulCommClass α R A]\n\n/-- The action on a submodule corresponding to applying the action to every element.\n\nThis is available as an instance in the `pointwise` locale.\n\nThis is a stronger version of `Submodule.pointwiseDistribMulAction`. -/\nprotected def pointwiseMulSemiringAction : MulSemiringAction α (Submodule R A) :=\n {\n Submodule.pointwiseDistribMulAction with\n smul_mul := fun r x y => Submodule.map_mul x y <| MulSemiringAction.toAlgHom R A r\n smul_one := fun r => Submodule.map_one <| MulSemiringAction.toAlgHom R A r }\n#align submodule.pointwise_mul_semiring_action Submodule.pointwiseMulSemiringAction\n\nscoped[Pointwise] attribute [instance] Submodule.pointwiseMulSemiringAction\n\nend\n\nend Ring\n\nsection CommRing\n\nvariable {A : Type v} [CommSemiring A] [Algebra R A]\n\nvariable {M N : Submodule R A} {m n : A}\n\ntheorem mul_mem_mul_rev (hm : m ∈ M) (hn : n ∈ N) : n * m ∈ M * N :=\n mul_comm m n ▸ mul_mem_mul hm hn\n#align submodule.mul_mem_mul_rev Submodule.mul_mem_mul_rev\n\nvariable (M N)\n\nprotected theorem mul_comm : M * N = N * M :=\n le_antisymm (mul_le.2 fun _r hrm _s hsn => mul_mem_mul_rev hsn hrm)\n (mul_le.2 fun _r hrn _s hsm => mul_mem_mul_rev hsm hrn)\n#align submodule.mul_comm Submodule.mul_comm\n\n/-- Sub-R-modules of an R-algebra A form a semiring. -/\ninstance : IdemCommSemiring (Submodule R A) :=\n { Submodule.idemSemiring with mul_comm := Submodule.mul_comm }\n\ntheorem prod_span {ι : Type*} (s : Finset ι) (M : ι → Set A) :\n (∏ i in s, Submodule.span R (M i)) = Submodule.span R (∏ i in s, M i) := by\n letI := Classical.decEq ι\n refine' Finset.induction_on s _ _\n · simp [one_eq_span, Set.singleton_one]\n · intro _ _ H ih\n rw [Finset.prod_insert H]\n rw [Finset.prod_insert H]\n rw [ih]\n rw [span_mul_span]\n#align submodule.prod_span Submodule.prod_span\n\ntheorem prod_span_singleton {ι : Type*} (s : Finset ι) (x : ι → A) :\n (∏ i in s, span R ({x i} : Set A)) = span R {∏ i in s, x i} := by\n rw [prod_span]\n rw [Set.finset_prod_singleton]\n#align submodule.prod_span_singleton Submodule.prod_span_singleton\n\nvariable (R A)\n\n/-- R-submodules of the R-algebra A are a module over `Set A`. -/\ninstance moduleSet : Module (SetSemiring A) (Submodule R A) where\n -- porting note: have to unfold both `HSMul.hSMul` and `SMul.smul`\n smul s P := span R (SetSemiring.down s) * P\n smul_add _ _ _ := mul_add _ _ _\n add_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_add, span_union, sup_mul, add_eq_sup]\n mul_smul s t P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_mul, ← mul_assoc, span_mul_span]\n one_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_one, ← one_eq_span_one_set, one_mul]\n zero_smul P := by\n simp_rw [HSMul.hSMul, SetSemiring.down_zero, span_empty, bot_mul, bot_eq_zero]\n smul_zero _ := mul_bot _\n#align submodule.module_set Submodule.moduleSet\n\nvariable {R A}\n\ntheorem smul_def (s : SetSemiring A) (P : Submodule R A) :\n s • P = span R (SetSemiring.down s) * P :=\n rfl\n#align submodule.smul_def Submodule.smul_def\n\ntheorem smul_le_smul {s t : SetSemiring A} {M N : Submodule R A}\n (h₁ : SetSemiring.down s ⊆ SetSemiring.down t)\n (h₂ : M ≤ N) : s • M ≤ t • N :=\n mul_le_mul (span_mono h₁) h₂\n#align submodule.smul_le_smul Submodule.smul_le_smul\n\ntheorem smul_singleton (a : A) (M : Submodule R A) :\n Set.up ({a} : Set A) • M = M.map (LinearMap.mulLeft R a) := by\n conv_lhs => rw [← span_eq M]\n change span _ _ * span _ _ = _\n rw [span_mul_span]\n apply le_antisymm\n · rw [span_le]\n rintro _ ⟨b, m, hb, hm, rfl⟩\n rw [SetLike.mem_coe]\n rw [mem_map]\n rw [Set.mem_singleton_iff.mp hb]\n exact ⟨m, hm, rfl⟩\n · rintro _ ⟨m, hm, rfl⟩\n exact subset_span ⟨a, m, Set.mem_singleton a, hm, rfl⟩\n#align submodule.smul_singleton Submodule.smul_singleton\n\nsection Quotient\n\n/-- The elements of `I / J` are the `x` such that `x • J ⊆ I`.\n\nIn fact, we define `x ∈ I / J` to be `∀ y ∈ J, x * y ∈ I` (see `mem_div_iff_forall_mul_mem`),\nwhich is equivalent to `x • J ⊆ I` (see `mem_div_iff_smul_subset`), but nicer to use in proofs.\n\nThis is the general form of the ideal quotient, traditionally written $I : J$.\n-/\ninstance : Div (Submodule R A) :=\n ⟨fun I J =>\n { carrier := { x | ∀ y ∈ J, x * y ∈ I }\n zero_mem' := fun y _ => by\n rw [zero_mul]\n apply Submodule.zero_mem\n add_mem' := fun ha hb y hy => by\n rw [add_mul]\n exact Submodule.add_mem _ (ha _ hy) (hb _ hy)\n smul_mem' := fun r x hx y hy => by\n rw [Algebra.smul_mul_assoc]\n exact Submodule.smul_mem _ _ (hx _ hy) }⟩\n\ntheorem mem_div_iff_forall_mul_mem {x : A} {I J : Submodule R A} : x ∈ I / J ↔ ∀ y ∈ J, x * y ∈ I :=\n Iff.refl _\n#align submodule.mem_div_iff_forall_mul_mem Submodule.mem_div_iff_forall_mul_mem\n\ntheorem mem_div_iff_smul_subset {x : A} {I J : Submodule R A} : x ∈ I / J ↔ x • (J : Set A) ⊆ I :=\n ⟨fun h y ⟨y', hy', xy'_eq_y⟩ => by\n rw [← xy'_eq_y]\n apply h\n assumption, fun h y hy => h (Set.smul_mem_smul_set hy)⟩\n#align submodule.mem_div_iff_smul_subset Submodule.mem_div_iff_smul_subset\n\ntheorem le_div_iff {I J K : Submodule R A} : I ≤ J / K ↔ ∀ x ∈ I, ∀ z ∈ K, x * z ∈ J :=\n Iff.refl _\n#align submodule.le_div_iff Submodule.le_div_iff\n\ntheorem le_div_iff_mul_le {I J K : Submodule R A} : I ≤ J / K ↔ I * K ≤ J := by\n rw [le_div_iff]\n rw [mul_le]\n#align submodule.le_div_iff_mul_le Submodule.le_div_iff_mul_le\n\n@[simp]\ntheorem one_le_one_div {I : Submodule R A} : 1 ≤ 1 / I ↔ I ≤ 1 := by\n constructor; all_goals intro hI\n · rwa [le_div_iff_mul_le, one_mul] at hI\n · rwa [le_div_iff_mul_le, one_mul]\n#align submodule.one_le_one_div Submodule.one_le_one_div\n\ntheorem le_self_mul_one_div {I : Submodule R A} (hI : I ≤ 1) : I ≤ I * (1 / I) := by\n refine (mul_one I).symm.trans_le ?_ -- porting note: drop `rw {occs := _}` in favor of `refine`\n apply mul_le_mul_right (one_le_one_div.mpr hI)\n#align submodule.le_self_mul_one_div Submodule.le_self_mul_one_div\n\ntheorem mul_one_div_le_one {I : Submodule R A} : I * (1 / I) ≤ 1 := by\n rw [Submodule.mul_le]\n intro m hm n hn\n rw [Submodule.mem_div_iff_forall_mul_mem] at hn\n rw [mul_comm]\n exact hn m hm\n#align submodule.mul_one_div_le_one Submodule.mul_one_div_le_one\n\n@[simp]\nprotected theorem map_div {B : Type*} [CommSemiring B] [Algebra R B] (I J : Submodule R A)\n (h : A ≃ₐ[R] B) : (I / J).map h.toLinearMap = I.map h.toLinearMap / J.map h.toLinearMap := by\n ext x\n simp only [mem_map, mem_div_iff_forall_mul_mem]\n constructor\n · rintro ⟨x, hx, rfl⟩ _ ⟨y, hy, rfl⟩\n exact ⟨x * y, hx _ hy, h.map_mul x y⟩\n · rintro hx\n refine' ⟨h.symm x, fun z hz => _, h.apply_symm_apply x⟩\n obtain ⟨xz, xz_mem, hxz⟩ := hx (h z) ⟨z, hz, rfl⟩\n convert xz_mem\n apply h.injective\n ","nextTactic":"erw [h.map_mul, h.apply_symm_apply, hxz]","declUpToTactic":"@[simp]\nprotected theorem map_div {B : Type*} [CommSemiring B] [Algebra R B] (I J : Submodule R A)\n (h : A ≃ₐ[R] B) : (I / J).map h.toLinearMap = I.map h.toLinearMap / J.map h.toLinearMap := by\n ext x\n simp only [mem_map, mem_div_iff_forall_mul_mem]\n constructor\n · rintro ⟨x, hx, rfl⟩ _ ⟨y, hy, rfl⟩\n exact ⟨x * y, hx _ hy, h.map_mul x y⟩\n · rintro hx\n refine' ⟨h.symm x, fun z hz => _, h.apply_symm_apply x⟩\n obtain ⟨xz, xz_mem, hxz⟩ := hx (h z) ⟨z, hz, rfl⟩\n convert xz_mem\n apply h.injective\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Operations.768_0.IvhXmXo9kppbroj","decl":"@[simp]\nprotected theorem map_div {B : Type*} [CommSemiring B] [Algebra R B] (I J : Submodule R A)\n (h : A ≃ₐ[R] B) : (I / J).map h.toLinearMap = I.map h.toLinearMap / J.map h.toLinearMap "}