login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Edit detail for ClosedLinearOperator revision 1 of 4

1 2 3 4
Editor: Bill Page
Time: 2011/05/31 18:32:11 GMT-7
Note: Experiments with ribbons

changed:
-
Introduction

  Bi-graded two-color linear operators (transformations) over a finite n-dimensional vector space, including products and duals on a field $K$. Members of this domain are morphisms $K^{\pm^n} \to K^{\pm^m},$ where $K^{+}=K,$ $K^{++}=A\otimes A,$ and $K^{-}=K^*,$ (dual), etc. Products, permutations and composition (grafting) of morphisms are implemented.  Operators are represented internally as tensors.

Operator composition and products can be visualized by oriented directed graphs. The graphs have a top and a bottom and arrows are directed either downwards or upwards.

External vertices in this graph represent vectors, tensors and their duals. Internal nodes and arcs (edges) represent linear operators. Edges may be one of two different "colors" (labelled + and - in the code that follows) or marked with arrows directed either downwards (+) or upwards (-). Horizontal juxtaposition (i.e. a horizontal cross-section) represents tensor product. Vertical juxtaposition of edges of the same color represents operator composition.

See examples and documentation <a href="#getting_started">below</a>

I would be glad if you to make brief comments in the form at the <a href="#comments">bottom</a> of this web page. For more detailed but related comments click "discussion":http:/LinearOperatorDiscussion on the top menu.

Regards,
Bill Page.

<a name="source_code">Source Code</a>

  We try to start by defining the concept of a compact closed category.

Ref:

- http://en.wikipedia.org/wiki/Closed_monoidal_category

- http://en.wikipedia.org/wiki/Compact_closed_category

\begin{spad}
)abbrev domain ARITY Arity
Arity():  Exports == Implementation where
  COLOR ==> OrderedVariableList ['_+,'_-]
  LIST2 ==> ListFunctions2
  NNI ==> NonNegativeInteger
  RS ==> Record(gen:COLOR,exp:NNI)

  Exports ==> Join(Monoid, RetractableTo COLOR) with
    index: PositiveInteger -> %
    dn: () -> %
      ++ default
    up: () -> %
      ++ dual
    0: %
      ++ use 0 for identity
    "+": (%,%) -> %
      ++ composition
    size: % -> NonNegativeInteger
    len: % -> Integer
    color: (%,NNI) -> %
    overlap: (%,%) -> Record(lm:%, mm:%, rm:%)
  Implementation ==> FreeMonoid COLOR add
    Rep == FreeMonoid COLOR
    rep(x:%):Rep == x pretend Rep
    per(x:Rep):% == x pretend %
    index(x:PositiveInteger):% == per(index(x)$COLOR ::Rep)
    up():% == index(2)
    dn():% == index(1)
    0:% == per 1
    (f:% + g:%):% == per(rep f * rep g)
    coerce(x:%):OutputForm == (rep(x)=1 => message "0";rep(x)::OutputForm)
    -- size of FreeMonoid is just number of factors
    -- len is total length
    len(f:%):Integer ==
      reduce(_+,map(x+->x.exp,factors rep f)$LIST2(RS,NNI),0)$List(NNI) pretend Integer
    -- i'th element
    color(f:%,i:NNI):% ==
      j:NNI:=0
      for x in factors rep f repeat
        j:=j+x.exp
        if j>=i then
          return per coerce x.gen
      error "index error"
\end{spad}

\begin{spad}
)abbrev category CMONAL ClosedMonoidal
ClosedMonoidal():Category == Ring with
    dom: % -> Arity
      ++ domain
    cod: % -> Arity
      ++ co-domain
    _/: (%,%) -> %
      ++ vertical composition f/g
    apply: (%,%) -> %
      ++ horizontal product f g = f*g
    "^": (%,Arity) -> %
      ++ colored power
    dagger: % -> %
      ++ reverse arrows:
      ++ cod f = dom dagger f
      ++ dom f = cod dagger f
\end{spad}

The initial object in this category is the domain ClosedProp (Products and Permutations). The ClosedProp domain represents everything that is "constant" about all the domains in this category. It can be defined as an endofunctor with only the information available about the category itself. 

\begin{spad}
)abbrev domain CPROP ClosedProp
ClosedProp(L:ClosedMonoidal): Exports == Implementation where

  Exports ==> ClosedMonoidal with
    coerce: L -> %

  Implementation ==> add
    Rep == Record(domain:Arity, codomain:Arity)
    rep(x:%):Rep == x pretend Rep
    per(x:Rep):% == x pretend %

    coerce(f:%):OutputForm == dom(f)::OutputForm / cod(f)::OutputForm

    coerce(f:L):% == per [dom f, cod f]                    -- coerce(f:L):% == per f

    dom(x:%):Arity == rep(x).domain                          -- dom(x:%):NNI == dom rep x
    cod(x:%):Arity == rep(x).codomain                        -- cod(x:%):NNI == cod rep x
    --0:% == per [1,1]                                       -- 0:% == per 0
    1:% == per [1,1]                                       -- 1:% == per 1
    -- evaluation
    (f:% / g:%):% == per [dom f, cod g]                    -- (f:% / g:%):% == per (rep f / rep g)
    -- product
    apply(f:%,g:%):% == per [dom f * dom g, cod f * cod g] -- apply(f:%,g:%):% == per apply(rep f,rep g)
    (f:% * g:%):% == per [dom f * dom g, cod f * cod g]    --(f:% * g:%):% == per (rep f * rep g)
    -- sum
    --(f:% + g:%):% == per [dom f, cod f]                    --(f:% + g:%):% == per (rep f + rep g)
    dagger(f:%):% == per [cod f, dom f]
    (f:% ^ p:Arity):% ==
       r:% := 1
       for i in 1..len(p) repeat
         if color(p,i)=dn() then
           r:=r*f
         else
           r:=r*dagger(f)
       return r
\end{spad}

The ClosedLinearOperator domain is ClosedMonoidal over FreeMonoid OrderedVariables ['_+,'_-], i.e. strings of $\pm$ symbols. The objects of this domain are all tensor powers of a vector space of fixed dimension. The arrows are linear operators that map from one object (tensor powers of vector space and it's dual) to another such power.

Ref: http://en.wikipedia.org/wiki/Category_of_vector_spaces

- all members of this domain have the same dimension

Faster tensors
\begin{axiom}
)lib CARTEN
\end{axiom}

\begin{spad}
)abbrev domain CLOP ClosedLinearOperator
ClosedLinearOperator(gener:OrderedFinite,K:Field): Exports == Implementation where
  NNI ==> NonNegativeInteger
  Exports ==> Join(Ring, VectorSpace K, ClosedMonoidal, RetractableTo K) with
    arity: % -> ClosedProp %
    basisOut: () -> List %
    basisIn: () -> List %
    map: (K->K,%) -> %
    if K has Evalable(K) then Evalable(K)
    eval: % -> %
    ravel: % -> List K
    unravel: (ClosedProp %,List K) -> %
    coerce:(x:List Integer) -> %
      ++ identity for composition and permutations of its products
    coerce:(x:List None) -> %
      ++ [] = 1
    elt: (%,%) -> %
    elt: (%,Integer) -> %
    elt: (%,Integer,Integer) -> %
    elt: (%,Integer,Integer,Integer) -> %
    _/: (Tuple %,Tuple %) -> %
    _/: (Tuple %,%) -> %
    _/: (%,Tuple %) -> %
      ++ yet another syntax for product
    ev: NNI -> %
      ++ (2,0)-tensor for evaluation
    co: NNI -> %
      ++ (0,2)-tensor for co-evaluation
  Implementation ==> add

    LIST2 ==> ListFunctions2
    dim:NNI := size()$gener
    T := CartesianTensor(1,dim,K)
    L := Record(domain:Arity, codomain:Arity, data:T)
    RR := Record(gen:L,exp:NNI)
    -- FreeMonoid provides unevaluated products
    Rep == FreeMonoid L
    rep(x:%):Rep == x pretend Rep
    per(x:Rep):% == x pretend %
    dimension():CardinalNumber == coerce dim

    -- Prop (arity)
    dom(f:%):Arity ==
      reduce(_*,map(x+->(x.gen.domain)^(x.exp),factors rep f)$LIST2(RR,Arity),1)$List(Arity)
    cod(f:%):Arity ==
      reduce(_*,map(x+->(x.gen.codomain)^(x.exp),factors rep f)$LIST2(RR,Arity),1)$List(Arity)
    dagger(f:%):% ==
      r:=1
      for f1 in factors rep f repeat
        p:List Integer := concat [ _
          [len(f1.gen.domain)+i for i in 1..len(f1.gen.codomain)], _
          [i for i in 1..len(f1.gen.domain)]]
        r:= per(coerce [f1.gen.codomain, f1.gen.domain, reindex(f1.gen.data,p) ])^f1.exp * r
      return r

    prod(f:L,g:L):L ==
      r:T := product(f.data,g.data)
      -- dom(f) + cod(f) + dom(g) + cod(g)
      p:List Integer := concat                _
        [[i for i in 1..len(f.domain)],              _
        [len(f.domain)+len(f.codomain)+i for i in 1..len(g.domain)], _
        [len(f.domain)+i for i in 1..len(f.codomain)],        _
        [len(f.domain)+len(g.domain)+len(f.codomain)+i for i in 1..len(g.codomain)]]
        -- dom(f) + dom(g) + cod(f) + cod(g)
      --output("prod p = ",p::OutputForm)$OutputPackage
      [(f.domain)*(g.domain),(f.codomain)*(g.codomain),reindex(r,p)]

    dats(fs:List RR):L ==
      r:L := [1,1,1$T]  -- scalar 1 as tensor
      for y in fs repeat
        t:L:=y.gen
        for n in 1..y.exp repeat
          r:=prod(r,t)
      return r

    dat(f:Rep):L == dats factors f
      
    arity(f:%):ClosedProp % == f::ClosedProp %

    eval(f:%):% == per coerce dat(rep f)

    retractIfCan(f:%):Union(K,"failed") ==
      dom(f)=1 and cod(f)=1 => retract(dat(rep f).data)$T
      return "failed"
    retract(f:%):K ==
      dom(f)=1 and cod(f)=1 => retract(dat(rep f).data)$T
      error "failed"

    -- basis
    basisOut():List % == [per coerce [1,dn(),entries(row(1,i)$SquareMatrix(dim,K))::T] for i in 1..dim]
    basisIn():List % == [per coerce [dn(),1,entries(row(1,i)$SquareMatrix(dim,K))::T] for i in 1..dim]
    ev(n:NNI):% == reduce(_+,[ dx^n * dx^n for dx in basisIn()])$List(%)
    co(n:NNI):% == reduce(_+,[ Dx^n * Dx^n for Dx in basisOut()])$List(%)

    -- manipulation
    map(f:K->K, g:%):% == per coerce [dom g,cod g,unravel(map(f,ravel dat(rep g).data))$T]
    if K has Evalable(K) then
      eval(g:%,f:List Equation K):% == map((x:K):K+->eval(x,f),g)
    ravel(g:%):List K == ravel dat(rep g).data
    unravel(p:ClosedProp %,r:List K):% ==
      dim^(len(dom(p)*cod(p)) pretend NNI) ~= #r => error "failed"
      per coerce [dom(p),cod(p),unravel(r)$T]

    -- sum
    (f:% + g:%):% ==
      dat(rep f).data=0 => g
      dat(rep g).data=0 => f
      dom(f) ~= dom(g) or cod(f) ~= cod(g) => error "arity"
      per coerce [dom f,cod f,dat(rep f).data+dat(rep g).data]

    (f:% - g:%):% ==
      dat(rep f).data=0 => g
      dat(rep g).data=0 => f
      dom(f) ~= dom(f) or cod(g) ~= cod(g) => error "arity"
      per coerce [dom f, cod f,dat(rep f).data-dat(rep g).data]

    _-(f:%):% == per coerce [dom f, cod f,-dat(rep f).data]

    (x:% = y:%):Boolean ==
      if rep x = rep y then true
      else rep eval x = rep eval y

    -- identity for sum (trivial zero map)
    0 == per coerce [1,1,0]
    zero?(f:%):Boolean == dat(rep f).data = 0 * dat(rep f).data
    -- identity for product
    1:% == per 1
    one?(f:%):Boolean == one? rep f
    -- identity for composition
    I := per coerce [dn(),dn(),kroneckerDelta()$T]

    -- permutations and identities
    coerce(p:List Integer):% ==
      r:=I^#p
      --#p = 1 and p.1 = 1 => return r
      p3:List Integer:=concat [ _
        [i for i in 1..#p], _
        [#p+abs(i) for i in p]]
      d:Arity:=dn()^(#p)
      c:Arity := reduce(_*,map((x:Integer):Arity+->(x>0=>dn();up()),p)$LIST2(Integer,Arity))$List(Arity)
      r:=per coerce [d, c, reindex(dat(rep r).data,p3)]
      return r
    coerce(p:List None):% == per coerce [1,1,1]

    -- product
    elt(f:%,g:%):% == f * g
    elt(f:%,g:Integer):% == f * [g @ Integer]::List Integer::%
    elt(f:%,g1:Integer,g2:Integer):% == f * [g1 @ Integer,g2 @ Integer]::List Integer::%
    elt(f:%,g1:Integer,g2:Integer,g3:Integer):% ==
      f * [g1 @ Integer,g2 @ Integer,g3 @ Integer]::List Integer::%
    apply(f:%,g:%):% == f * g
    -- just free monoid product
    (f:% * g:%):% ==
      r := per (rep f * rep g)
      -- evaluate scalars
      if dom(f)=1 and cod(f)=1 then return eval(r)
      if dom(g)=1 and cod(g)=1 then return eval(r)
      return r

    coerce(x:K):% == 1*x

    -- tensor powers
    (f:% ^ p:Arity):% ==
       r:% := 1
       for i in 1..len(p) repeat
         if color(p,i)=dn() then
           r:=r*f
         else
           r:=r*dagger(f)
       return r

    -- returns arity of leading identities
    leadI(x:Rep):Arity ==
      xx := x
      s:Arity:=1
      repeat
        r:=overlap(rep(I),xx)
        if r.rm=1 and r.mm=rep(I) then
          s := s * dn()
          xx:= r.lm
        else
          r:=overlap(rep(dagger I),xx)
          if r.rm=1 and r.mm=rep(I) then
            s := s * up()
            xx:= r.lm
          else
            break
      return s

    -- returns arity of trailing identities
    trailI(x:Rep):Arity ==
      xx := x
      s:Arity:=1
      repeat
        r:=overlap(xx,rep(I))
        if r.lm=1 and r.mm=rep(I) then
          s := dn() * s
          xx:= r.rm
        else
          r:=overlap(xx,rep(dagger I))
          if r.lm=1 and r.mm=rep(I) then
            s := up() * s
            xx:= r.rm
          else
            break
      return s

    -- tensor composition:
    compose(lnf:Integer,f:Rep,lfn:Integer, lng:Integer,g:Rep,lgn:Integer):T ==
      ldf := len dom(per f)
      lcf := len cod(per f)
      ldg := len dom(per g)
      lcg := len cod(per g)
      --output("ldf, lcf, ldg, lcg = ", [ldf,lcf,ldg,lcg]::List Integer::OutputForm)$OutputPackage
      r:T := contract(lcf-lng-lgn, dat(f).data,ldf+lng+1, dat(g).data,lnf+1)
      p:List Integer:=concat [ _
        [ldf+lgn+i for i in 1..lnf], _
        [i for i in 1..ldf], _
        [ldf+lnf+lng+i for i in 1..lfn], _
        [ldf+i for i in 1..lng], _
        [ldf+lnf+lng+lfn+lgn+i for i in 1..lcg], _
        [ldf+lng+i for i in 1..lgn] ]
      --print(p::OutputForm)$OutputForm
      return reindex(r,p)

    parallelize(f:Rep,g:Rep):Record(f1:Rep,g1:Rep,f2:Rep,g2:Rep) ==
      -- parallelize composition f/g = (f1/g1)*(f2/g2)
      r:Record(f1:Rep,g1:Rep,f2:Rep,g2:Rep):=[1,1,1,1]
      if cod(per f)~=1 then
        i:Integer:=1
        j:Integer:=1
        n:NNI:=1
        m:NNI:=1
        r.f1 := nthFactor(f,1)::Rep
        r.g1 := nthFactor(g,1)::Rep
        while cod(per r.f1) ~= dom(per r.g1) repeat
          if len(cod per r.f1) < len(dom per r.g1) then
            if n < nthExpon(f,i) then
              n:=n+1
            else
              n:=1
              i:=i+1
            r.f1 := r.f1 * nthFactor(f,i)::Rep
          else if len(cod per r.f1) > len(dom per r.g1) then
            if m < nthExpon(g,j) then
              m:=m+1
            else
              n:=1
              j:=j+1
            r.g1 := r.g1 * nthFactor(g,j)::Rep
        r.f2 := overlap(r.f1, f).rm
        r.g2 := overlap(r.g1, g).rm
      --print(r::OutputForm)$OutputForm
      return r

    -- f/g : A^n -> A^p = f:A^n -> A^m / g:A^m -> A^p
    (ff:% / gg:%):% ==
      -- scalars
      if dom(ff)=1 and cod(ff)=1 and dom(gg)=1 and cod(gg)=1 then return ff*gg
      fg:=overlap(cod ff,dom gg)
      if fg.rm~=1 or fg.lm~=1 then
        -- pass extra f inputs on the left
        -- pass extra g outputs on the right
        print(hconcat([message("arity warning: "), _
              over(arity(ff)::OutputForm * arity(I^(fg.rm))::OutputForm, _
                   arity(I^(fg.lm))::OutputForm * arity(gg)::OutputForm) ]))$OutputForm
      r:=parallelize(rep(ff*I^(fg.rm)),rep(I^(fg.lm)*gg))
      -- remove leading and trailing identities
      nf := leadI r.f1
      r.f1 := overlap(rep(I^nf),r.f1).rm
      ng := leadI r.g1
      r.g1 := overlap(rep(I^ng),r.g1).rm
      --output("nf,ng = ",[nf,ng]::List Arity::OutputForm)$OutputPackage
      fn := trailI r.f1
      f := overlap(r.f1,rep(I^fn)).lm
      gn := trailI r.g1
      g := overlap(r.g1,rep(I^gn)).lm
      --output("fn,gn = ",[fn,gn]::List Arity::OutputForm)$OutputPackage
      -- parallel factors guarantees that these are just identities
      if nf~=1 and nf=ng then
        return I^nf*(per(r.f2)/per(r.g2))
      if fn~=1 and gn~=1 then
        return (per(f)/per(g))*I^fn
      return per([nf*dom(per f)*fn, ng*cod(per g)*gn, _
                  compose(len nf,f,len fn, len ng,g,len gn)]::Rep) * _
             (per(r.f2)/per(r.g2))

    -- another notation for composition of products
    (t:Tuple % / x:%):% == t / construct([x])$PrimitiveArray(%)::Tuple(%)
    (x:% / t:Tuple %):% == construct([x])$PrimitiveArray(%)::Tuple(%) / t
    (f:Tuple % / g:Tuple %):% ==
      fs:List % := [select(f,i) for i in 0..length(f)-1]
      gs:List % := [select(g,i) for i in 0..length(g)-1]
      fr:=reduce(elt@(%,%)->%,fs,1)
      gr:=reduce(elt@(%,%)->%,gs,1)
      fr / gr

    (x:K * y:%):% == per coerce [dom y, cod y,x*dat(rep y).data]
    (x:% * y:K):% == per coerce [dom x,cod x,dat(rep x).data*y]
    (x:Integer * y:%):% == per coerce [dom y,cod y,x*dat(rep y).data]

    -- display operators using basis
    show(x:%):OutputForm ==
      dom(x)=1 and cod(x)=1 => return (dat(rep x).data)::OutputForm
      gens:List OutputForm:=[index(i::PositiveInteger)$gener::OutputForm for i in 1..dim]
      -- input basis
      inps:List OutputForm := list empty()
      dx:=dom(x)
      for i in 1..len(dx) repeat
        --empty? inps => inps:=gens
        inps:=concat [[(inps.k * (color(dx,i)=dn()=>gens.j;super(gens.j,message "*"))) _
          for j in 1..dim] for k in 1..#inps]
      -- output basis
      outs:List OutputForm := list empty()
      cx:=cod(x)
      for i in 1..len(cx) repeat
        --empty? outs => outs:=gens
        outs:=concat [[(outs.k * (color(cx,i)=dn()=>gens.j;super(gens.j,message "*"))) _
          for j in 1..dim] for k in 1..#outs]
      -- combine input (superscripts) and/or output(subscripts) to form basis symbols
      bases:List OutputForm
      if #inps > 0 and #outs > 0 then
        bases:=concat([[ scripts(message("|"),[i,j]) for i in outs] for j in inps])
      else if #inps > 0 then
        bases:=[super(message("|"),i) for i in inps]
      else if #outs > 0 then
        bases:=[sub(message("|"),j) for j in outs]
      else
        bases:List OutputForm:= []
      -- merge bases with data to form term list
      terms:=[(k=1 => base;k::OutputForm*base)
        for base in bases for k in ravel(x) | k~=0]
      empty? terms => return 0::OutputForm
      -- combine the terms
      return reduce(_+,terms)

    coerce(x:%):OutputForm ==
      r:OutputForm := empty()
      for y in factors(rep x) repeat
        if y.exp = 1 then
          if size rep x = 1 then
            r := show per coerce y.gen
          else
            r:=r*paren(list show per coerce y.gen)
        else
          r:=r*paren(list show per coerce y.gen)^(y.exp::OutputForm)
      return r
\end{spad}

<A NAME="getting_started">Getting Started</A>

  Consult the source code <a href="#source_code">above</a> for more details.

Convenient Notation
\begin{axiom}
-- summation
macro Σ(f,i,b) == reduce(+,[f*b.i for i in 1..#b])
-- list comprehension
macro Ξ(f,i)==[f for i in 1..retract(dimension()$L)]
\end{axiom}

Example
\begin{axiom}
Q := EXPR INT
L := CLOP(OVAR ['x,'y],Q)
)show L
\end{axiom}

Basis
\begin{axiom}
dim:Integer:=retract dimension()$L
Dx:=basisOut()$L
dx:=basisIn()$L
matrix Ξ(Ξ( eval(dx.i * Dx.j), i),j)
matrix Ξ(Ξ( Dx.i / dx.j, i),j)
\end{axiom}

(1,1)-tensor
\begin{axiom}
A:L := Σ( Σ( script(a,[[j],[i]]), i,Dx), j,dx)
a:=arity(A)
p:=dom(A)
\end{axiom}
scalar
\begin{axiom}
s:= 3::L
arity s
2*s
s*2
\end{axiom}

Powers
\begin{axiom}
A^p
a^p
\end{axiom}

\begin{axiom}
s/A
A/s
3*A
A/3
\end{axiom}
identities
\begin{axiom}
I:L := [1]
I*I
arity(I*I)
I/I
H:L:=[1,2]
arity(H)
eval(I*I)
arity eval(I*I)
test( I*I = H )
-- twist
X:L := [2,1]
test(X/X=H)
-- printing
I*X*X*I
-- trace
U:L:=ev(1)
Ω:L:=co(1)
Ω/U
test
  ( I Ω  ) /
  (  U I ) = I
test
  (  Ω I ) /
  ( I U  ) = I
\end{axiom}

Back to the <a href="#source_code">top</a>.

<a name="comments">Comments</a>

  Please leave comments and suggestions.

  Thanks

  Bill Page

From BillPage Thu May 26 18:39:40 -0700 2011
From: Bill Page
Date: Thu, 26 May 2011 18:39:40 -0700
Subject: Experiments with ribbons
Message-ID: <20110526183940-0700@axiom-wiki.newsynthesis.org>

SandBoxRibbonCategory

Introduction

Bi-graded two-color linear operators (transformations) over a finite n-dimensional vector space, including products and duals on a field K. Members of this domain are morphisms K^{\pm^n} \to K^{\pm^m}, where K^{+}=K, K^{++}=A\otimes A, and K^{-}=K^<em>, (dual), etc. Products, permutations and composition (grafting) of morphisms are implemented. Operators are represented internally as tensors.

Operator composition and products can be visualized by oriented directed graphs. The graphs have a top and a bottom and arrows are directed either downwards or upwards.

External vertices in this graph represent vectors, tensors and their duals. Internal nodes and arcs (edges) represent linear operators. Edges may be one of two different "colors" (labelled + and - in the code that follows) or marked with arrows directed either downwards (+) or upwards (-). Horizontal juxtaposition (i.e. a horizontal cross-section) represents tensor product. Vertical juxtaposition of edges of the same color represents operator composition.

See examples and documentation below

I would be glad if you to make brief comments in the form at the bottom of this web page. For more detailed but related comments click discussion on the top menu.

Regards, Bill Page.

Source Code

We try to start by defining the concept of a compact closed category.

Ref:

spad
)abbrev domain ARITY Arity
Arity():  Exports == Implementation where
  COLOR ==> OrderedVariableList ['_+,'_-]
  LIST2 ==> ListFunctions2
  NNI ==> NonNegativeInteger
  RS ==> Record(gen:COLOR,exp:NNI)
Exports ==> Join(Monoid, RetractableTo COLOR) with index: PositiveInteger -> % dn: () -> % ++ default up: () -> % ++ dual 0: % ++ use 0 for identity "+": (%,%) -> % ++ composition size: % -> NonNegativeInteger len: % -> Integer color: (%,NNI) -> % overlap: (%,%) -> Record(lm:%, mm:%, rm:%) Implementation ==> FreeMonoid COLOR add Rep == FreeMonoid COLOR rep(x:%):Rep == x pretend Rep per(x:Rep):% == x pretend % index(x:PositiveInteger):% == per(index(x)$COLOR ::Rep) up():% == index(2) dn():% == index(1) 0:% == per 1 (f:% + g:%):% == per(rep f * rep g) coerce(x:%):OutputForm == (rep(x)=1 => message "0";rep(x)::OutputForm) -- size of FreeMonoid is just number of factors -- len is total length len(f:%):Integer == reduce(_+,map(x+->x.exp,factors rep f)$LIST2(RS,NNI),0)$List(NNI) pretend Integer -- i'th element color(f:%,i:NNI):% == j:NNI:=0 for x in factors rep f repeat j:=j+x.exp if j>=i then return per coerce x.gen error "index error"
spad
   Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/3593414395608860020-25px001.spad
      using old system compiler.
   ARITY abbreviates domain Arity 
------------------------------------------------------------------------
   initializing NRLIB ARITY for Arity 
   compiling into NRLIB ARITY 
************* USER ERROR **********
available signatures for Rep: 
    NONE
NEED Rep: () -> ?
****** comp fails at level 1 with expression: ******
((DEF (|Rep|) (NIL) (NIL)
  (|FreeMonoid| (|OrderedVariableList| (|construct| '+ '-)))))
****** level 1  ******
$x:= (DEF (Rep) (NIL) (NIL) (FreeMonoid (OrderedVariableList (construct (QUOTE +) (QUOTE -)))))
$m:= $EmptyMode
$f:=
((((|$Information| #) (|#| #) (< #) (<= #) ...)))
>> Apparent user error: unspecified error

spad
)abbrev category CMONAL ClosedMonoidal
ClosedMonoidal():Category == Ring with
    dom: % -> Arity
      ++ domain
    cod: % -> Arity
      ++ co-domain
    _/: (%,%) -> %
      ++ vertical composition f/g
    apply: (%,%) -> %
      ++ horizontal product f g = f*g
    "^": (%,Arity) -> %
      ++ colored power
    dagger: % -> %
      ++ reverse arrows:
      ++ cod f = dom dagger f
      ++ dom f = cod dagger f
spad
   Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/7854049118560040482-25px002.spad
      using old system compiler.
   CMONAL abbreviates category ClosedMonoidal 
------------------------------------------------------------------------
   initializing NRLIB CMONAL for ClosedMonoidal 
   compiling into NRLIB CMONAL 
;;; *** |ClosedMonoidal| REDEFINED Time: 0 SEC.
finalizing NRLIB CMONAL Processing ClosedMonoidal for Browser database: --->-->ClosedMonoidal(constructor): Not documented!!!! --------(dom (Arity %))--------- --------(cod (Arity %))--------- --------(/ (% % %))--------- --->-->ClosedMonoidal((/ (% % %))): Improper first word in comments: vertical "vertical composition \\spad{f/g}" --------(apply (% % %))--------- --->-->ClosedMonoidal((apply (% % %))): Improper first word in comments: horizontal "horizontal product \\spad{f} \\spad{g} = \\spad{f*g}" --------(^ (% % Arity))--------- --------(dagger (% %))--------- --->-->ClosedMonoidal(): Missing Description ; compiling file "/var/aw/var/LatexWiki/CMONAL.NRLIB/CMONAL.lsp" (written 01 APR 2013 09:58:31 PM):
; /var/aw/var/LatexWiki/CMONAL.NRLIB/CMONAL.fasl written ; compilation finished in 0:00:00.005 ------------------------------------------------------------------------ ClosedMonoidal is now explicitly exposed in frame initial ClosedMonoidal will be automatically loaded when needed from /var/aw/var/LatexWiki/CMONAL.NRLIB/CMONAL

The initial object in this category is the domain ClosedProp? (Products and Permutations). The ClosedProp? domain represents everything that is "constant" about all the domains in this category. It can be defined as an endofunctor with only the information available about the category itself.

spad
)abbrev domain CPROP ClosedProp
ClosedProp(L:ClosedMonoidal): Exports == Implementation where
Exports ==> ClosedMonoidal with coerce: L -> %
Implementation ==> add Rep == Record(domain:Arity, codomain:Arity) rep(x:%):Rep == x pretend Rep per(x:Rep):% == x pretend %
coerce(f:%):OutputForm == dom(f)::OutputForm / cod(f)::OutputForm
coerce(f:L):% == per [dom f, cod f] -- coerce(f:L):% == per f
dom(x:%):Arity == rep(x).domain -- dom(x:%):NNI == dom rep x cod(x:%):Arity == rep(x).codomain -- cod(x:%):NNI == cod rep x --0:% == per [1,1] -- 0:% == per 0 1:% == per [1,1] -- 1:% == per 1 -- evaluation (f:% / g:%):% == per [dom f, cod g] -- (f:% / g:%):% == per (rep f / rep g) -- product apply(f:%,g:%):% == per [dom f * dom g, cod f * cod g] -- apply(f:%,g:%):% == per apply(rep f,rep g) (f:% * g:%):% == per [dom f * dom g, cod f * cod g] --(f:% * g:%):% == per (rep f * rep g) -- sum --(f:% + g:%):% == per [dom f, cod f] --(f:% + g:%):% == per (rep f + rep g) dagger(f:%):% == per [cod f, dom f] (f:% ^ p:Arity):% == r:% := 1 for i in 1..len(p) repeat if color(p,i)=dn() then r:=r*f else r:=r*dagger(f) return r
spad
   Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/7228414894644034724-25px003.spad
      using old system compiler.
   CPROP abbreviates domain ClosedProp 
------------------------------------------------------------------------
   initializing NRLIB CPROP for ClosedProp 
   compiling into NRLIB CPROP 
************* USER ERROR **********
available signatures for Rep: 
    NONE
NEED Rep: () -> ?
****** comp fails at level 1 with expression: ******
((DEF (|Rep|) (NIL) (NIL)
  (|Record| (|:| |domain| |Arity|) (|:| |codomain| |Arity|))))
****** level 1  ******
$x:= (DEF (Rep) (NIL) (NIL) (Record (: domain Arity) (: codomain Arity)))
$m:= $EmptyMode
$f:=
((((|$Information| #) (~= #) (= #) (|coerce| #) ...)))
>> Apparent user error: unspecified error

The ClosedLinearOperator? domain is ClosedMonoidal? over FreeMonoid? OrderedVariables? ['_+,'_-]?, i.e. strings of \pm symbols. The objects of this domain are all tensor powers of a vector space of fixed dimension. The arrows are linear operators that map from one object (tensor powers of vector space and it's dual) to another such power.

Ref: http://en.wikipedia.org/wiki/Category_of_vector_spaces

  • all members of this domain have the same dimension

Faster tensors

axiom
)lib CARTEN
CartesianTensor is now explicitly exposed in frame initial CartesianTensor will be automatically loaded when needed from /var/aw/var/LatexWiki/CARTEN.NRLIB/CARTEN

spad
)abbrev domain CLOP ClosedLinearOperator
ClosedLinearOperator(gener:OrderedFinite,K:Field): Exports == Implementation where
  NNI ==> NonNegativeInteger
  Exports ==> Join(Ring, VectorSpace K, ClosedMonoidal, RetractableTo K) with
    arity: % -> ClosedProp %
    basisOut: () -> List %
    basisIn: () -> List %
    map: (K->K,%) -> %
    if K has Evalable(K) then Evalable(K)
    eval: % -> %
    ravel: % -> List K
    unravel: (ClosedProp %,List K) -> %
    coerce:(x:List Integer) -> %
      ++ identity for composition and permutations of its products
    coerce:(x:List None) -> %
      ++ [] = 1
    elt: (%,%) -> %
    elt: (%,Integer) -> %
    elt: (%,Integer,Integer) -> %
    elt: (%,Integer,Integer,Integer) -> %
    _/: (Tuple %,Tuple %) -> %
    _/: (Tuple %,%) -> %
    _/: (%,Tuple %) -> %
      ++ yet another syntax for product
    ev: NNI -> %
      ++ (2,0)-tensor for evaluation
    co: NNI -> %
      ++ (0,2)-tensor for co-evaluation
  Implementation ==> add
LIST2 ==> ListFunctions2 dim:NNI := size()$gener T := CartesianTensor(1,dim,K) L := Record(domain:Arity, codomain:Arity, data:T) RR := Record(gen:L,exp:NNI) -- FreeMonoid provides unevaluated products Rep == FreeMonoid L rep(x:%):Rep == x pretend Rep per(x:Rep):% == x pretend % dimension():CardinalNumber == coerce dim
-- Prop (arity) dom(f:%):Arity == reduce(_*,map(x+->(x.gen.domain)^(x.exp),factors rep f)$LIST2(RR,Arity),1)$List(Arity) cod(f:%):Arity == reduce(_*,map(x+->(x.gen.codomain)^(x.exp),factors rep f)$LIST2(RR,Arity),1)$List(Arity) dagger(f:%):% == r:=1 for f1 in factors rep f repeat p:List Integer := concat [ _ [len(f1.gen.domain)+i for i in 1..len(f1.gen.codomain)], _ [i for i in 1..len(f1.gen.domain)]] r:= per(coerce [f1.gen.codomain, f1.gen.domain, reindex(f1.gen.data,p) ])^f1.exp * r return r
prod(f:L,g:L):L == r:T := product(f.data,g.data) -- dom(f) + cod(f) + dom(g) + cod(g) p:List Integer := concat _ [[i for i in 1..len(f.domain)], _ [len(f.domain)+len(f.codomain)+i for i in 1..len(g.domain)], _ [len(f.domain)+i for i in 1..len(f.codomain)], _ [len(f.domain)+len(g.domain)+len(f.codomain)+i for i in 1..len(g.codomain)]] -- dom(f) + dom(g) + cod(f) + cod(g) --output("prod p = ",p::OutputForm)$OutputPackage [(f.domain)*(g.domain),(f.codomain)*(g.codomain),reindex(r,p)]
dats(fs:List RR):L == r:L := [1,1,1$T] -- scalar 1 as tensor for y in fs repeat t:L:=y.gen for n in 1..y.exp repeat r:=prod(r,t) return r
dat(f:Rep):L == dats factors f
arity(f:%):ClosedProp % == f::ClosedProp %
eval(f:%):% == per coerce dat(rep f)
retractIfCan(f:%):Union(K,"failed") == dom(f)=1 and cod(f)=1 => retract(dat(rep f).data)$T return "failed" retract(f:%):K == dom(f)=1 and cod(f)=1 => retract(dat(rep f).data)$T error "failed"
-- basis basisOut():List % == [per coerce [1,dn(),entries(row(1,i)$SquareMatrix(dim,K))::T] for i in 1..dim] basisIn():List % == [per coerce [dn(),1,entries(row(1,i)$SquareMatrix(dim,K))::T] for i in 1..dim] ev(n:NNI):% == reduce(_+,[ dx^n * dx^n for dx in basisIn()])$List(%) co(n:NNI):% == reduce(_+,[ Dx^n * Dx^n for Dx in basisOut()])$List(%)
-- manipulation map(f:K->K, g:%):% == per coerce [dom g,cod g,unravel(map(f,ravel dat(rep g).data))$T] if K has Evalable(K) then eval(g:%,f:List Equation K):% == map((x:K):K+->eval(x,f),g) ravel(g:%):List K == ravel dat(rep g).data unravel(p:ClosedProp %,r:List K):% == dim^(len(dom(p)*cod(p)) pretend NNI) ~= #r => error "failed" per coerce [dom(p),cod(p),unravel(r)$T]
-- sum (f:% + g:%):% == dat(rep f).data=0 => g dat(rep g).data=0 => f dom(f) ~= dom(g) or cod(f) ~= cod(g) => error "arity" per coerce [dom f,cod f,dat(rep f).data+dat(rep g).data]
(f:% - g:%):% == dat(rep f).data=0 => g dat(rep g).data=0 => f dom(f) ~= dom(f) or cod(g) ~= cod(g) => error "arity" per coerce [dom f, cod f,dat(rep f).data-dat(rep g).data]
_-(f:%):% == per coerce [dom f, cod f,-dat(rep f).data]
(x:% = y:%):Boolean == if rep x = rep y then true else rep eval x = rep eval y
-- identity for sum (trivial zero map) 0 == per coerce [1,1,0] zero?(f:%):Boolean == dat(rep f).data = 0 * dat(rep f).data -- identity for product 1:% == per 1 one?(f:%):Boolean == one? rep f -- identity for composition I := per coerce [dn(),dn(),kroneckerDelta()$T]
-- permutations and identities coerce(p:List Integer):% == r:=I^#p --#p = 1 and p.1 = 1 => return r p3:List Integer:=concat [ _ [i for i in 1..#p], _ [#p+abs(i) for i in p]] d:Arity:=dn()^(#p) c:Arity := reduce(_*,map((x:Integer):Arity+->(x>0=>dn();up()),p)$LIST2(Integer,Arity))$List(Arity) r:=per coerce [d, c, reindex(dat(rep r).data,p3)] return r coerce(p:List None):% == per coerce [1,1,1]
-- product elt(f:%,g:%):% == f * g elt(f:%,g:Integer):% == f * [g @ Integer]::List Integer::% elt(f:%,g1:Integer,g2:Integer):% == f * [g1 @ Integer,g2 @ Integer]::List Integer::% elt(f:%,g1:Integer,g2:Integer,g3:Integer):% == f * [g1 @ Integer,g2 @ Integer,g3 @ Integer]::List Integer::% apply(f:%,g:%):% == f * g -- just free monoid product (f:% * g:%):% == r := per (rep f * rep g) -- evaluate scalars if dom(f)=1 and cod(f)=1 then return eval(r) if dom(g)=1 and cod(g)=1 then return eval(r) return r
coerce(x:K):% == 1*x
-- tensor powers (f:% ^ p:Arity):% == r:% := 1 for i in 1..len(p) repeat if color(p,i)=dn() then r:=r*f else r:=r*dagger(f) return r
-- returns arity of leading identities leadI(x:Rep):Arity == xx := x s:Arity:=1 repeat r:=overlap(rep(I),xx) if r.rm=1 and r.mm=rep(I) then s := s * dn() xx:= r.lm else r:=overlap(rep(dagger I),xx) if r.rm=1 and r.mm=rep(I) then s := s * up() xx:= r.lm else break return s
-- returns arity of trailing identities trailI(x:Rep):Arity == xx := x s:Arity:=1 repeat r:=overlap(xx,rep(I)) if r.lm=1 and r.mm=rep(I) then s := dn() * s xx:= r.rm else r:=overlap(xx,rep(dagger I)) if r.lm=1 and r.mm=rep(I) then s := up() * s xx:= r.rm else break return s
-- tensor composition: compose(lnf:Integer,f:Rep,lfn:Integer, lng:Integer,g:Rep,lgn:Integer):T == ldf := len dom(per f) lcf := len cod(per f) ldg := len dom(per g) lcg := len cod(per g) --output("ldf, lcf, ldg, lcg = ", [ldf,lcf,ldg,lcg]::List Integer::OutputForm)$OutputPackage r:T := contract(lcf-lng-lgn, dat(f).data,ldf+lng+1, dat(g).data,lnf+1) p:List Integer:=concat [ _ [ldf+lgn+i for i in 1..lnf], _ [i for i in 1..ldf], _ [ldf+lnf+lng+i for i in 1..lfn], _ [ldf+i for i in 1..lng], _ [ldf+lnf+lng+lfn+lgn+i for i in 1..lcg], _ [ldf+lng+i for i in 1..lgn] ] --print(p::OutputForm)$OutputForm return reindex(r,p)
parallelize(f:Rep,g:Rep):Record(f1:Rep,g1:Rep,f2:Rep,g2:Rep) == -- parallelize composition f/g = (f1/g1)*(f2/g2) r:Record(f1:Rep,g1:Rep,f2:Rep,g2:Rep):=[1,1,1,1] if cod(per f)~=1 then i:Integer:=1 j:Integer:=1 n:NNI:=1 m:NNI:=1 r.f1 := nthFactor(f,1)::Rep r.g1 := nthFactor(g,1)::Rep while cod(per r.f1) ~= dom(per r.g1) repeat if len(cod per r.f1) < len(dom per r.g1) then if n < nthExpon(f,i) then n:=n+1 else n:=1 i:=i+1 r.f1 := r.f1 * nthFactor(f,i)::Rep else if len(cod per r.f1) > len(dom per r.g1) then if m < nthExpon(g,j) then m:=m+1 else n:=1 j:=j+1 r.g1 := r.g1 * nthFactor(g,j)::Rep r.f2 := overlap(r.f1, f).rm r.g2 := overlap(r.g1, g).rm --print(r::OutputForm)$OutputForm return r
-- f/g : A^n -> A^p = f:A^n -> A^m / g:A^m -> A^p (ff:% / gg:%):% == -- scalars if dom(ff)=1 and cod(ff)=1 and dom(gg)=1 and cod(gg)=1 then return ff*gg fg:=overlap(cod ff,dom gg) if fg.rm~=1 or fg.lm~=1 then -- pass extra f inputs on the left -- pass extra g outputs on the right print(hconcat([message("arity warning: "), _ over(arity(ff)::OutputForm * arity(I^(fg.rm))::OutputForm, _ arity(I^(fg.lm))::OutputForm * arity(gg)::OutputForm) ]))$OutputForm r:=parallelize(rep(ff*I^(fg.rm)),rep(I^(fg.lm)*gg)) -- remove leading and trailing identities nf := leadI r.f1 r.f1 := overlap(rep(I^nf),r.f1).rm ng := leadI r.g1 r.g1 := overlap(rep(I^ng),r.g1).rm --output("nf,ng = ",[nf,ng]::List Arity::OutputForm)$OutputPackage fn := trailI r.f1 f := overlap(r.f1,rep(I^fn)).lm gn := trailI r.g1 g := overlap(r.g1,rep(I^gn)).lm --output("fn,gn = ",[fn,gn]::List Arity::OutputForm)$OutputPackage -- parallel factors guarantees that these are just identities if nf~=1 and nf=ng then return I^nf*(per(r.f2)/per(r.g2)) if fn~=1 and gn~=1 then return (per(f)/per(g))*I^fn return per([nf*dom(per f)*fn, ng*cod(per g)*gn, _ compose(len nf,f,len fn, len ng,g,len gn)]::Rep) * _ (per(r.f2)/per(r.g2))
-- another notation for composition of products (t:Tuple % / x:%):% == t / construct([x])$PrimitiveArray(%)::Tuple(%) (x:% / t:Tuple %):% == construct([x])$PrimitiveArray(%)::Tuple(%) / t (f:Tuple % / g:Tuple %):% == fs:List % := [select(f,i) for i in 0..length(f)-1] gs:List % := [select(g,i) for i in 0..length(g)-1] fr:=reduce(elt@(%,%)->%,fs,1) gr:=reduce(elt@(%,%)->%,gs,1) fr / gr
(x:K * y:%):% == per coerce [dom y, cod y,x*dat(rep y).data] (x:% * y:K):% == per coerce [dom x,cod x,dat(rep x).data*y] (x:Integer * y:%):% == per coerce [dom y,cod y,x*dat(rep y).data]
-- display operators using basis show(x:%):OutputForm == dom(x)=1 and cod(x)=1 => return (dat(rep x).data)::OutputForm gens:List OutputForm:=[index(i::PositiveInteger)$gener::OutputForm for i in 1..dim] -- input basis inps:List OutputForm := list empty() dx:=dom(x) for i in 1..len(dx) repeat --empty? inps => inps:=gens inps:=concat [[(inps.k * (color(dx,i)=dn()=>gens.j;super(gens.j,message "*"))) _ for j in 1..dim] for k in 1..#inps] -- output basis outs:List OutputForm := list empty() cx:=cod(x) for i in 1..len(cx) repeat --empty? outs => outs:=gens outs:=concat [[(outs.k * (color(cx,i)=dn()=>gens.j;super(gens.j,message "*"))) _ for j in 1..dim] for k in 1..#outs] -- combine input (superscripts) and/or output(subscripts) to form basis symbols bases:List OutputForm if #inps > 0 and #outs > 0 then bases:=concat([[ scripts(message("|"),[i,j]) for i in outs] for j in inps]) else if #inps > 0 then bases:=[super(message("|"),i) for i in inps] else if #outs > 0 then bases:=[sub(message("|"),j) for j in outs] else bases:List OutputForm:= [] -- merge bases with data to form term list terms:=[(k=1 => base;k::OutputForm*base) for base in bases for k in ravel(x) | k~=0] empty? terms => return 0::OutputForm -- combine the terms return reduce(_+,terms)
coerce(x:%):OutputForm == r:OutputForm := empty() for y in factors(rep x) repeat if y.exp = 1 then if size rep x = 1 then r := show per coerce y.gen else r:=r*paren(list show per coerce y.gen) else r:=r*paren(list show per coerce y.gen)^(y.exp::OutputForm) return r
spad
   Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/6254316795179946290-25px005.spad
      using old system compiler.
   CLOP abbreviates domain ClosedLinearOperator 
------------------------------------------------------------------------
   initializing NRLIB CLOP for ClosedLinearOperator 
   compiling into NRLIB CLOP 
   processing macro definition LIST2 ==> ListFunctions2 
************* USER ERROR **********
available signatures for Rep: 
    NONE
NEED Rep: () -> ?
****** comp fails at level 1 with expression: ******
((DEF (|Rep|) (NIL) (NIL) (|FreeMonoid| L)))
****** level 1  ******
$x:= (DEF (Rep) (NIL) (NIL) (FreeMonoid L))
$m:= $EmptyMode
$f:=
((((|copy| #) (|setelt| #) (|exp| #) (|setelt| #) ...)))
>> Apparent user error: unspecified error

Getting Started

Consult the source code above for more details.

Convenient Notation

axiom
-- summation
macro Σ(f,i,b) == reduce(+,[f*b.i for i in 1..#b])
Type: Void
axiom
-- list comprehension
macro Ξ(f,i)==[f for i in 1..retract(dimension()$L)]
Type: Void

Example

axiom
Q := EXPR INT

\label{eq1}\hbox{\axiomType{Expression}\ } (\hbox{\axiomType{Integer}\ })(1)
Type: Type
axiom
L := CLOP(OVAR ['x,'y],Q)
ClosedLinearOperator is an unknown constructor and so is unavailable. Did you mean to use -> but type something different instead?
axiom
)show L
The )show system command is used to display information about types or partial types. For example, )show Integer will show information about Integer .
L is not the name of a known type constructor. If you want to see information about any operations named L , issue )display operations L

Basis

axiom
dim:Integer:=retract dimension()$L
The function dimension is not implemented in NIL . Dx:=basisOut()$L
The function basisOut is not implemented in NIL . dx:=basisIn()$L
The function basisIn is not implemented in NIL . matrix Ξ(Ξ( eval(dx.i * Dx.j), i),j)
The function dimension is not implemented in NIL . matrix Ξ(Ξ( Dx.i / dx.j, i),j)
The function dimension is not implemented in NIL .

(1,1)-tensor

axiom
A:L := Σ( Σ( script(a,[[j],[i]]), i,Dx), j,dx)
There are 2 exposed and 1 unexposed library operations named # having 1 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op # to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation.
Cannot find a definition or applicable library operation named # with argument type(s) Variable(dx)
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. a:=arity(A)
There are 1 exposed and 0 unexposed library operations named arity having 1 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op arity to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation.
Cannot find a definition or applicable library operation named arity with argument type(s) Variable(A)
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. p:=dom(A)

\label{eq2}\left(\hbox{\axiomType{Variable}\ } \  A \right)(2)
Type: SExpression?

scalar

axiom
s:= 3::L
Cannot convert from type PositiveInteger to NIL for value 3
arity s
There are 1 exposed and 0 unexposed library operations named arity having 1 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op arity to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation.
Cannot find a definition or applicable library operation named arity with argument type(s) Variable(s)
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. 2*s

\label{eq3}2 \  s(3)
Type: Polynomial(Integer)
axiom
s*2

\label{eq4}2 \  s(4)
Type: Polynomial(Integer)

Powers

axiom
A^p
There are 17 exposed and 19 unexposed library operations named ^ having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op ^ to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation.
Cannot find a definition or applicable library operation named ^ with argument type(s) Variable(A) SExpression
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. a^p
There are 17 exposed and 19 unexposed library operations named ^ having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op ^ to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation.
Cannot find a definition or applicable library operation named ^ with argument type(s) Variable(a) SExpression
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need.

axiom
s/A

\label{eq5}s \over A(5)
Type: Fraction(Polynomial(Integer))
axiom
A/s

\label{eq6}A \over s(6)
Type: Fraction(Polynomial(Integer))
axiom
3*A

\label{eq7}3 \  A(7)
Type: Polynomial(Integer)
axiom
A/3

\label{eq8}{1 \over 3}\  A(8)
Type: Polynomial(Fraction(Integer))

identities

axiom
I:L := [1]

\label{eq9}\left[ 1 \right](9)
Type: List(PositiveInteger?)
axiom
I*I
There are 35 exposed and 33 unexposed library operations named * having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op * to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation.
Cannot find a definition or applicable library operation named * with argument type(s) List(PositiveInteger) List(PositiveInteger)
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. arity(I*I)
There are 35 exposed and 33 unexposed library operations named * having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op * to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation.
Cannot find a definition or applicable library operation named * with argument type(s) List(PositiveInteger) List(PositiveInteger)
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. I/I
There are 13 exposed and 12 unexposed library operations named / having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op / to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation.
Cannot find a definition or applicable library operation named / with argument type(s) List(PositiveInteger) List(PositiveInteger)
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. H:L:=[1,2]

\label{eq10}\left[ 1, \: 2 \right](10)
Type: List(PositiveInteger?)
axiom
arity(H)
There are 1 exposed and 0 unexposed library operations named arity having 1 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op arity to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation.
Cannot find a definition or applicable library operation named arity with argument type(s) List(PositiveInteger)
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. eval(I*I)
There are 35 exposed and 33 unexposed library operations named * having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op * to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation.
Cannot find a definition or applicable library operation named * with argument type(s) List(PositiveInteger) List(PositiveInteger)
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. arity eval(I*I)
There are 35 exposed and 33 unexposed library operations named * having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op * to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation.
Cannot find a definition or applicable library operation named * with argument type(s) List(PositiveInteger) List(PositiveInteger)
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. test( I*I = H )
There are 35 exposed and 33 unexposed library operations named * having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op * to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation.
Cannot find a definition or applicable library operation named * with argument type(s) List(PositiveInteger) List(PositiveInteger)
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. -- twist X:L := [2,1]

\label{eq11}\left[ 2, \: 1 \right](11)
Type: List(PositiveInteger?)
axiom
test(X/X=H)
There are 13 exposed and 12 unexposed library operations named / having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op / to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation.
Cannot find a definition or applicable library operation named / with argument type(s) List(PositiveInteger) List(PositiveInteger)
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. -- printing I*X*X*I
There are 35 exposed and 33 unexposed library operations named * having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op * to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation.
Cannot find a definition or applicable library operation named * with argument type(s) List(PositiveInteger) List(PositiveInteger)
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. -- trace U:L:=ev(1)
There are no library operations named ev Use HyperDoc Browse or issue )what op ev to learn if there is any operation containing " ev " in its name.
Cannot find a definition or applicable library operation named ev with argument type(s) PositiveInteger
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. Ω:L:=co(1)
There are no library operations named co Use HyperDoc Browse or issue )what op co to learn if there is any operation containing " co " in its name.
Cannot find a definition or applicable library operation named co with argument type(s) PositiveInteger
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. Ω/U

\label{eq12}�� \over U(12)
Type: Fraction(Polynomial(Integer))
axiom
test
  ( I Ω  ) /
  (  U I ) = I
There are no exposed library operations named I but there is one unexposed operation with that name. Use HyperDoc Browse or issue )display op I to learn more about the available operation.
Cannot find a definition or applicable library operation named I with argument type(s) Variable(Ω)
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. test ( Ω I ) / ( I U ) = I
There are no library operations named Ω Use HyperDoc Browse or issue )what op Ω to learn if there is any operation containing " Ω " in its name.
Cannot find a definition or applicable library operation named Ω with argument type(s) List(PositiveInteger)
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need.

Back to the top.

Comments

Please leave comments and suggestions.

Thanks

Bill Page

Experiments with ribbons --Bill Page, Thu, 26 May 2011 18:39:40 -0700 reply
SandBoxRibbonCategory?