aboutsummaryrefslogtreecommitdiff
path: root/Data/Vector/Semimodule.agda
blob: f6fe2de7ba61e5b56d1dd4511c80ae390d2c775e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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
        }
    }