aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Comeaux <jacquesrcomeaux@protonmail.com>2026-03-29 17:49:49 -0500
committerJacques Comeaux <jacquesrcomeaux@protonmail.com>2026-03-29 17:49:49 -0500
commit29dacb01350879a1f94ca100aafc058298bcb8a1 (patch)
treee7b9bf6e2c2ec4606865199fb06d70d1d2897731
parent0000b8aee0c002bfdf0f0a310062a80c2c8ea94d (diff)
Add semimodule of vectors over a commutative rig
-rw-r--r--Data/Vector/Semimodule.agda41
1 files changed, 41 insertions, 0 deletions
diff --git a/Data/Vector/Semimodule.agda b/Data/Vector/Semimodule.agda
new file mode 100644
index 0000000..f6fe2de
--- /dev/null
+++ b/Data/Vector/Semimodule.agda
@@ -0,0 +1,41 @@
+{-# OPTIONS --without-K --safe #-}
+
+open import Algebra using (CommutativeSemiring)
+open import Level using (Level; _⊔_)
+
+module Data.Vector.Semimodule {c ℓ : Level} (R : CommutativeSemiring c ℓ) where
+
+module R = CommutativeSemiring R
+
+import Data.Vec.Relation.Binary.Pointwise.Inductive as PW
+
+open import Algebra.Module using (Bisemimodule; Semimodule)
+open import Data.Nat using (ℕ)
+open import Data.Vector.Core R.setoid using (Vector; _≊_)
+open import Data.Vec using (Vec)
+open import Data.Vector.Bisemimodule R.semiring using (⟨_⟩_; _⟨_⟩; Vector-Bisemimodule)
+
+open R
+open Vec
+
+private
+ variable
+ n : ℕ
+
+opaque
+
+ unfolding ⟨_⟩_ _⟨_⟩
+
+ -- scaling on left equals scaling on right
+ ⟨-⟩-comm : (r : Carrier) (V : Vector n) → r ⟨ V ⟩ ≊ ⟨ V ⟩ r
+ ⟨-⟩-comm r [] = PW.[]
+ ⟨-⟩-comm r (x ∷ V) = *-comm r x PW.∷ ⟨-⟩-comm r V
+
+Vector-Semimodule : ℕ → Semimodule R c (c ⊔ ℓ)
+Vector-Semimodule n = record
+ { Bisemimodule (Vector-Bisemimodule n)
+ ; isSemimodule = record
+ { isBisemimodule = record { Bisemimodule (Vector-Bisemimodule n) }
+ ; *ₗ-*ᵣ-coincident = ⟨-⟩-comm
+ }
+ }