open import Level
open import Function
open import Data.Product
open import Relation.Unary
open import Algebra.Bundles
open import Algebra.Module

module Algebra.SubModule.Base {ℓr} {ℓm}
  {ring : Ring ℓm ℓr}
  (leftModule : LeftModule ring ℓm ℓm)
  where

open Ring ring
open LeftModule leftModule
open import Relation.Binary.Reasoning.Setoid ≈ᴹ-setoid
open import Algebra.Solver.CommutativeMonoid +ᴹ-commutativeMonoid
open import Algebra.Definitions (_≐_ {_} {Carrierᴹ} {ℓm})

private variable
   ℓ′ : Level

Cᴹ : ( : Level)  Set (ℓm  suc )
Cᴹ  = Pred Carrierᴹ 

0ₛ : Cᴹ ℓm
0ₛ = _≈ᴹ 0ᴹ

_+ₛ_ : Cᴹ ℓm  Cᴹ ℓm  Cᴹ ℓm
(xs +ₛ ys) z = ∃⟨  ((x , y) : Carrierᴹ × Carrierᴹ)  x  xs × y  ys × x +ᴹ y ≈ᴹ z) 

span : Carrierᴹ  Cᴹ ℓm
span v x = ∃⟨  r  r *ₗ v ≈ᴹ x)