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

Edit detail for Limits and Colimits revision 4 of 5

1 2 3 4 5
Editor: Bill Page
Time: 2008/12/10 19:37:35 GMT-8
Note: principal branch coercions

added:
    coerce: X -> %

added:
    coerce: Y -> %

added:
    coerce(x:X):% == per [a==x]

added:
    coerce(y:Y):% == per [b==y]

added:
    coerce: X -> %

added:
    coerce: Y -> %

added:
    coerce: Z -> %

added:
    coerce(x:X):% == per [a==x]

added:
    coerce(y:Y):% == per [b==y]

added:
    coerce(z:Z):% == per [c==z]

changed:
-f:=sum(abs$Integer,wholePart$Float)$Sum2Functions(Integer,Float,Integer)
-f(inject1(-1)$Sum2(Integer,Float))
-f(inject2(3.14)$Sum2(Integer,Float))
f:Sum2(Integer,Float)->Integer:=sum(abs$Integer,wholePart$Float)
f(-1)
f(3.14)

Product is a limit in the sense of category theory. Given a set of domains X, Y, ... it constructs a new domain and a function (called project) from the new domain to each domain such that for any other domain A and functions f:A->X, g:A->Y, ... there exists a unique function called their product from A into the new domain which commutes with the project functions.

reference

aldor
#pile
#include "axiom"
Product2(X:SetCategory,Y:SetCategory): with
    construct: (X,Y) -> %
    coerce: % -> OutputForm
    product: (A:Type, A->X,A->Y) -> (A->%)
    project1: (%) -> X
    project2: (%) -> Y
  == add
    Rep == Record(a:X,b:Y)
    import from Rep
    --
    construct(x:X,y:Y):% == per [x,y]
    coerce(x:%):OutputForm ==
      bracket([coerce(rep(x).a)$X, coerce(rep(x).b)$Y]$List(OutputForm))
    project1(x:%):X == rep(x).a
    project2(y:%):Y == rep(y).b
    product(A:Type,f:A->X,g:A->Y):(A->%) ==
       (x:A):% +-> per [f(x),g(x)]
--
Product3(X:SetCategory,Y:SetCategory,Z:SetCategory): with
    construct: (X,Y,Z) -> %
    coerce: % -> OutputForm
    product: (A:Type, A->X,A->Y,A->Z) -> (A->%)
    project1: % -> X
    project2: % -> Y
    project3: % -> Z
  == add
    Rep == Record(a:X,b:Y,c:Z)
    import from Rep
    --
    construct(x:X,y:Y,z:Z):% == per [x,y,z]
    coerce(x:%):OutputForm ==
      bracket([coerce(rep(x).a)$X, coerce(rep(x).b)$Y, coerce(rep(x).c)$Z]$List(OutputForm))
    project1(x:%):X == rep(x).a
    project2(y:%):Y == rep(y).b
    project3(z:%):Z == rep(z).c
    product(A:Type,f:A->X,g:A->Y,h:A->Z):(A->%) ==
       (x:A):% +-> per [f(x),g(x),h(x)]
aldor
   Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/limits.as using AXIOM-XL compiler and 
      options 
-O -Fasy -Fao -Flsp -laxiom -Mno-ALDOR_W_WillObsolete -DAxiom -Y $AXIOM/algebra -I $AXIOM/algebra
      Use the system command )set compiler args to change these 
      options.
   Compiling Lisp source code from file ./limits.lsp
   Issuing )library command for limits
   Reading /var/zope2/var/LatexWiki/limits.asy
   Product2 is now explicitly exposed in frame initial 
   Product2 will be automatically loaded when needed from 
      /var/zope2/var/LatexWiki/limits
   Product3 is now explicitly exposed in frame initial 
   Product3 will be automatically loaded when needed from 
      /var/zope2/var/LatexWiki/limits
>> System error: The bounding indices 163 and 162 are bad for a sequence of length 162. See also: The ANSI Standard, Glossary entry for "bounding index designator" The ANSI Standard, writeup for Issue SUBSEQ-OUT-OF-BOUNDS:IS-AN-ERROR

axiom
)show Product2(Integer,Float)
Product2(Integer,Float) is a domain constructor. Abbreviation for Product2 is Product2 This constructor is exposed in this frame. ------------------------------- Operations --------------------------------
coerce : % -> OutputForm construct : (Integer,Float) -> % project1 : % -> Integer project2 : % -> Float product : (Type,(A -> Integer),(A -> Float)) -> (A -> %)
axiom
)show Product3(Integer,Integer,Integer)
Product3(Integer,Integer,Integer) is a domain constructor. Abbreviation for Product3 is Product3 This constructor is exposed in this frame. ------------------------------- Operations --------------------------------
coerce : % -> OutputForm project1 : % -> Integer project2 : % -> Integer project3 : % -> Integer construct : (Integer,Integer,Integer) -> % product : (Type,(A -> Integer),(A -> Integer),(A -> Integer)) -> (A -> %)

Sum is a co-limit in the sense of category theory. Given a set of domains X, Y, ... it constructs a new domain and a function (called inject) from each domain to the new domain such that for any other domain A and functions f:X->A, g:Y->A, ... there exists a unique function called their sum from the new domain into A which commutes with the inject functions.

reference

axiom
p:=[2,3.14]$Product2(Integer,Float)

\label{eq1}\left[ 2, \:{3.14}\right](1)
Type: Product2(Integer,Float)
axiom
q:=[2,3.14,"abc"]$Product3(Integer,Float,String)

\label{eq2}\left[ 2, \:{3.14}, \: \mbox{\tt "abc"}\right](2)
Type: Product3(Integer,Float,String)
axiom
r:=["a","b","c"]$Product3(String,String,String)

\label{eq3}\left[ \mbox{\tt "a"}, \: \mbox{\tt "b"}, \: \mbox{\tt "c"}\right](3)
Type: Product3(String,String,String)
axiom
project3 r

\label{eq4}\mbox{\tt "c"}(4)
Type: String

aldor
#pile
#include "axiom"
Sum2(X:SetCategory,Y:SetCategory): with
    coerce: % -> OutputForm
    inject1: X -> %
    coerce: X -> %
    inject2: Y -> %
    coerce: Y -> %
  == add
    Rep == Union(a:X,b:Y)
    import from Rep, Integer
    --
    coerce(x:%):OutputForm ==
      rep(x) case a => sub(coerce(rep(x).a)$X,outputForm 1)
      rep(x) case b => sub(coerce(rep(x).b)$Y,outputForm 2)
      never
    inject1(x:X):% == per [a==x]
    coerce(x:X):% == per [a==x]
    inject2(y:Y):% == per [b==y]
    coerce(y:Y):% == per [b==y]
-- Note: There is a problem with dependent domains in FriCAS so -- it is necessary to define 'sum' in a separate package.
Sum2Functions(X:SetCategory,Y:SetCategory,A:SetCategory): with sum: (X->A,Y->A) -> (Sum2(X,Y) -> A) -- Given two functions, each with one of the domains in this Sum -- and having a common co-domain A: returns the unique function with -- domain Sum and co-domain A == add -- Requires same Rep as domain Sum2! macro rep(x) == x pretend Union(a:X,b:Y) import from Union(a:X,b:Y) -- sum(f:X->A,g:Y->A):(Sum2(X,Y)->A) == (x:Sum2(X,Y)):A +-> rep(x) case a => f(rep(x).a) rep(x) case b => g(rep(x).b) never -- Sum3(X:SetCategory,Y:SetCategory,Z:SetCategory): with coerce: % -> OutputForm inject1: X -> % coerce: X -> % inject2: Y -> % coerce: Y -> % inject3: Z -> % coerce: Z -> % == add Rep == Union(a:X,b:Y,c:Z) import from Rep, Integer -- coerce(x:%):OutputForm == rep(x) case a => sub(coerce(rep(x).a)$X,outputForm 1) rep(x) case b => sub(coerce(rep(x).b)$Y,outputForm 2) rep(x) case c => sub(coerce(rep(x).c)$Z,outputForm 3) never inject1(x:X):% == per [a==x] coerce(x:X):% == per [a==x] inject2(y:Y):% == per [b==y] coerce(y:Y):% == per [b==y] inject3(z:Z):% == per [c==z] coerce(z:Z):% == per [c==z]
Sum3Functions(X:SetCategory,Y:SetCategory,Z:SetCategory,A:SetCategory): with sum: (X->A,Y->A,Z->A) -> (Sum3(X,Y,Z) -> A) -- Given three functions, each with one of the domains in this Sum -- and having a common co-domain A: returns the unique function with -- domain Sum and co-domain A == add -- Requires same Rep as domain Sum3! macro rep(x) == x pretend Union(a:X,b:Y,c:Z) import from Union(a:X,b:Y,c:Z) -- sum(f:X->A,g:Y->A,h:Z->A):(Sum3(X,Y,Z)->A) == (x:Sum3(X,Y,Z)):A +-> rep(x) case a => f(rep(x).a) rep(x) case b => g(rep(x).b) rep(x) case c => h(rep(x).c) never
aldor
   Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/colimits.as using AXIOM-XL compiler and 
      options 
-O -Fasy -Fao -Flsp -laxiom -Mno-ALDOR_W_WillObsolete -DAxiom -Y $AXIOM/algebra -I $AXIOM/algebra
      Use the system command )set compiler args to change these 
      options.
"/var/zope2/var/LatexWiki/colimits.as", line 32: 
    macro rep(x) == x pretend Union(a:X,b:Y)
..............^
[L32 C15] #1 (Warning) Definition of macro `rep' hides an outer definition.
"/var/zope2/var/LatexWiki/colimits.as", line 72: macro rep(x) == x pretend Union(a:X,b:Y,c:Z) ..............^ [L72 C15] #2 (Warning) Definition of macro `rep' hides an outer definition.
Compiling Lisp source code from file ./colimits.lsp Issuing )library command for colimits Reading /var/zope2/var/LatexWiki/colimits.asy Sum2 is now explicitly exposed in frame initial Sum2 will be automatically loaded when needed from /var/zope2/var/LatexWiki/colimits Sum2Functions is now explicitly exposed in frame initial Sum2Functions will be automatically loaded when needed from /var/zope2/var/LatexWiki/colimits Sum3 is now explicitly exposed in frame initial Sum3 will be automatically loaded when needed from /var/zope2/var/LatexWiki/colimits Sum3Functions is now explicitly exposed in frame initial Sum3Functions will be automatically loaded when needed from /var/zope2/var/LatexWiki/colimits
>> System error: The bounding indices 163 and 162 are bad for a sequence of length 162. See also: The ANSI Standard, Glossary entry for "bounding index designator" The ANSI Standard, writeup for Issue SUBSEQ-OUT-OF-BOUNDS:IS-AN-ERROR

axiom
)show Sum2(Integer,Float)
Sum2(Integer,Float) is a domain constructor. Abbreviation for Sum2 is SUM2 This constructor is exposed in this frame. ------------------------------- Operations --------------------------------
coerce : % -> OutputForm coerce : Float -> % coerce : Integer -> % inject1 : Integer -> % inject2 : Float -> %
axiom
)show Sum2Functions(Integer,Float,Integer)
Sum2Functions(Integer,Float,Integer) is a domain constructor. Abbreviation for Sum2Functions is SUM2FUN This constructor is exposed in this frame. ------------------------------- Operations --------------------------------
sum : ((Integer -> Integer),(Float -> Integer)) -> (Sum2(Integer,Float) -> Integer)
axiom
)show Sum3(Integer,Float,String)
Sum3(Integer,Float,String) is a domain constructor. Abbreviation for Sum3 is SUM3 This constructor is exposed in this frame. ------------------------------- Operations --------------------------------
coerce : % -> OutputForm coerce : Float -> % coerce : Integer -> % coerce : String -> % inject1 : Integer -> % inject2 : Float -> % inject3 : String -> %
axiom
)show Sum3Functions(Integer,Float,String)
The constructor Sum3Functions takes 4 arguments and you have given 3 .

Limits and co-limits are dual concepts in category theory. Notice in particular how the construction of Product and Sum above implement that duality. I am especially interested in how the duality between rep and per is involved in these constructions.

axiom
inject1(-1)$Sum2(Integer,Float)

\label{eq5}- 1_{1}(5)
Type: Sum2(Integer,Float)
axiom
inject2(-1.1)$Sum2(Integer,Float)

\label{eq6}-{1.1}_{2}(6)
Type: Sum2(Integer,Float)
axiom
inject3("c")$Sum3(String,String,String)

\label{eq7}\mbox{\tt "c"}_{3}(7)
Type: Sum3(String,String,String)

axiom
f:Sum2(Integer,Float)->Integer:=sum(abs$Integer,wholePart$Float)

\label{eq8}\mbox{theMap (...)}(8)
Type: (Sum2(Integer,Float) -> Integer)
axiom
f(-1)

\label{eq9}1(9)
Type: PositiveInteger?
axiom
f(3.14)

\label{eq10}3(10)
Type: PositiveInteger?