Module docstring
{"# The colon ideal
This file defines Submodule.colon N P as the ideal of all elements r : R such that r • P ⊆ N.
The normal notation for this would be N : P which has already been taken by type theory.
"}
{"# The colon ideal
This file defines Submodule.colon N P as the ideal of all elements r : R such that r • P ⊆ N.
The normal notation for this would be N : P which has already been taken by type theory.
"}
Submodule.colon
      definition
     (N P : Submodule R M) : Ideal R
        /-- `N.colon P` is the ideal of all elements `r : R` such that `r • P ⊆ N`. -/
def colon (N P : Submodule R M) : Ideal R where
  carrier := {r : R | (r • P : Set M) ⊆ N}
  add_mem' ha hb :=
    (Set.add_smul_subset _ _ _).trans ((Set.add_subset_add ha hb).trans_eq (by simp [← coe_sup]))
  zero_mem' := by simp [Set.zero_smul_set P.nonempty]
  smul_mem' r := by
    simp only [Set.mem_setOf_eq, smul_eq_mul, mul_smul, Set.smul_set_subset_iff]
    intro x hx y hy
    exact N.smul_mem _ (hx hy)
        Submodule.mem_colon
      theorem
     {r} : r ∈ N.colon P ↔ ∀ p ∈ P, r • p ∈ N
        theorem mem_colon {r} : r ∈ N.colon Pr ∈ N.colon P ↔ ∀ p ∈ P, r • p ∈ N := Set.smul_set_subset_iff
        Submodule.instIsTwoSidedColon
      instance
     : (N.colon P).IsTwoSided
        instance (priority := low) : (N.colon P).IsTwoSided where
  mul_mem_of_left {r} s hr p hp := by
    obtain ⟨p, hp, rfl⟩ := hp
    exact hr ⟨_, P.smul_mem _ hp, (mul_smul ..).symm⟩
        Submodule.colon_top
      theorem
     {I : Ideal R} [I.IsTwoSided] : I.colon ⊤ = I
        @[simp]
theorem colon_top {I : Ideal R} [I.IsTwoSided] : I.colon ⊤ = I := by
  simp_rw [SetLike.ext_iff, mem_colon, smul_eq_mul]
  exact fun x ↦ ⟨fun h ↦ mul_one x ▸ h 1 trivial, fun h _ _ ↦ I.mul_mem_right _ h⟩
        Submodule.colon_bot
      theorem
     : colon ⊥ N = N.annihilator
        @[simp]
theorem colon_bot : colon ⊥ N = N.annihilator := by
  simp_rw [SetLike.ext_iff, mem_colon, mem_annihilator, mem_bot, forall_const]
        Submodule.colon_mono
      theorem
     (hn : N₁ ≤ N₂) (hp : P₁ ≤ P₂) : N₁.colon P₂ ≤ N₂.colon P₁
        
      Submodule.mem_colon'
      theorem
     {r} : r ∈ N.colon P ↔ P ≤ comap (r • (LinearMap.id : M →ₗ[R] M)) N
        theorem mem_colon' {r} : r ∈ N.colon Pr ∈ N.colon P ↔ P ≤ comap (r • (LinearMap.id : M →ₗ[R] M)) N :=
  mem_colon
        Submodule.iInf_colon_iSup
      theorem
     (ι₁ : Sort*) (f : ι₁ → Submodule R M) (ι₂ : Sort*) (g : ι₂ → Submodule R M) :
  (⨅ i, f i).colon (⨆ j, g j) = ⨅ (i) (j), (f i).colon (g j)
        theorem iInf_colon_iSup (ι₁ : Sort*) (f : ι₁ → Submodule R M) (ι₂ : Sort*)
    (g : ι₂ → Submodule R M) : (⨅ i, f i).colon (⨆ j, g j) = ⨅ (i) (j), (f i).colon (g j) :=
  le_antisymm (le_iInf fun _ => le_iInf fun _ => colon_mono (iInf_le _ _) (le_iSup _ _)) fun _ H =>
    mem_colon'.2 <|
      iSup_le fun j =>
        map_le_iff_le_comap.1 <|
          le_iInf fun i =>
            map_le_iff_le_comap.2 <|
              mem_colon'.1 <|
                have := (mem_iInf _).1 H i
                have := (mem_iInf _).1 this j
                this
        Submodule.mem_colon_singleton
      theorem
     {N : Submodule R M} {x : M} {r : R} : r ∈ N.colon (Submodule.span R { x }) ↔ r • x ∈ N
        @[simp]
theorem mem_colon_singleton {N : Submodule R M} {x : M} {r : R} :
    r ∈ N.colon (Submodule.span R {x})r ∈ N.colon (Submodule.span R {x}) ↔ r • x ∈ N :=
  calc
    r ∈ N.colon (Submodule.span R {x}) ↔ ∀ a : R, r • a • x ∈ N := by
      simp [Submodule.mem_colon, Submodule.mem_span_singleton]
    _ ↔ r • x ∈ N := by simp_rw [fun (a : R) ↦ smul_comm r a x]; exact SetLike.forall_smul_mem_iff
        Ideal.mem_colon_singleton
      theorem
     {I : Ideal R} {x r : R} : r ∈ I.colon (Ideal.span { x }) ↔ r * x ∈ I
        @[simp]
theorem _root_.Ideal.mem_colon_singleton {I : Ideal R} {x r : R} :
    r ∈ I.colon (Ideal.span {x})r ∈ I.colon (Ideal.span {x}) ↔ r * x ∈ I := by
  simp only [← Ideal.submodule_span_eq, Submodule.mem_colon_singleton, smul_eq_mul]
        Submodule.annihilator_map_mkQ_eq_colon
      theorem
     : annihilator (P.map N.mkQ) = N.colon P
        @[simp]
lemma annihilator_map_mkQ_eq_colon : annihilator (P.map N.mkQ) = N.colon P := by
  ext
  rw [mem_annihilator, mem_colon]
  exact ⟨fun H p hp ↦ (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),
    fun H _ ⟨p, hp, hpm⟩ ↦ hpm ▸ ((Quotient.mk_eq_zero N).2 <| H p hp)⟩
        Submodule.annihilator_quotient
      theorem
     {N : Submodule R M} : Module.annihilator R (M ⧸ N) = N.colon ⊤
        theorem annihilator_quotient {N : Submodule R M} :
    Module.annihilator R (M ⧸ N) = N.colon ⊤ := by
  simp_rw [SetLike.ext_iff, Module.mem_annihilator, ← annihilator_map_mkQ_eq_colon, mem_annihilator,
    map_top, LinearMap.range_eq_top.mpr (mkQ_surjective N), mem_top, forall_true_left,
    forall_const]
        Ideal.annihilator_quotient
      theorem
     {I : Ideal R} [I.IsTwoSided] : Module.annihilator R (R ⧸ I) = I
        theorem _root_.Ideal.annihilator_quotient {I : Ideal R} [I.IsTwoSided] :
    Module.annihilator R (R ⧸ I) = I := by
  rw [Submodule.annihilator_quotient, colon_top]