; ----------------------------------------------------------------------- ; Curry function INCLUDED in the Camila Kernel ; (from setcat.cam) ; 11.99 ; curry : (A x B --> C) --> A --> (B -->C) curry(f) = lambda(a).lambda(b).'f(a,b); ; ----------------------------------------------------------------------- ; Functions related to Product and Coproduct INCLUDED in the Camila Kernel ; (from setcat.cam) ; 11.99 ; i1 : (A + B) <-- A i1(a) = <1,a>; ; i2 : (A + B) <-- B i2(b) = <2,b>; ; is1 : ( A + B ) --> 2 is1(x) = p1(x)==1; ; is2 : ( A + B ) --> 2 is2(x) = p1(x)==2; ; either : (A --> C) x (B --> C) --> ((A + B) --> C) either(f,g)=lambda(x).let (t=p1(x),y=p2(x)) in if t==1 then 'f(y) else 'g(y); ; sum : (A --> B) x (C --> D) --> ((A + C) --> (B + D)) sum(f,g) = either(comp(i1,f),comp(i2,g)); ; split : ( A --> B x C ) <-- ( A --> B ) x ( A --> C ) split(f,g)= lambda(x).<'f(x),'g(x)>; ; prod : (A --> B) x (C --> D) --> ((A x C) --> (B x D)) prod(f,g) = split(comp(f,p1),comp(g,p2)); ; ----------------------------------------------------------------------- ; To be included in setcat.cam ; n-ary versions of injections and product and coproduct ; universal and functorial arrows ; 11.99 ; ssplit : n-ary version of split ; receives a sequence of functions on the same domain ssplit(l)= tup(l); ; sprod : n-ary version of prod ; receives a sequence of functions ; alternative syntax: (f1 _x_ f2 _x_ ... _x_ fn) sprod(l)= fprod(l); ; ix : INT * Ax --> (A1 + A2 + ... + An) ix(x,a) = ; ; isx : (INT x (A1 + A2 + ... + An)) --> 2 isx(x,a) = p1(a)==x; ; seither : n-ary version of either ; receives a sequence of functions to the same codomain seither(l)= cotup(l); ; ssum : n-ary version of sum ; receives a sequence of functions ; alternative syntax: (f1 _+_ f2 _+_ ... _+_ fn) ssum(l)= fadd(l);