GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
1[1X5 [33X[0;0YRunning SCSCP server[133X[101X234[1X5.1 [33X[0;0YInstallation of [5XSCSCP[105X[101X[1X procedures[133X[101X56[33X[0;0YThere may various ways to run [5XSCSCP[105X server, for example:[133X78[30X [33X[0;6Yallowing generic services like evaluation of arbitrary [5XOpenMath[105X code;[133X910[30X [33X[0;6Yoffering highly specialized procedures like identification of groups11of order 512;[133X1213[30X [33X[0;6Yproviding access to a database of mathematical objects.[133X1415[33X[0;0YEach of these use cases requires certain control over the level of16functionality exposed to the client. To achieve this, before starting [5XSCSCP[105X17service its provider must call the function [2XInstallSCSCPprocedure[102X ([14X5.1-1[114X) to18make required procedures [21Xvisible[121X for the client.[133X1920[33X[0;0YAdditionally, the service can be made made accessible only for clients21running on the same computer, or accessible only through a particular22network interface, or generally accessible. This customization is made at23the stage of starting the [5XSCSCP[105X server with the function [2XRunSCSCPserver[102X24([14X5.2-1[114X).[133X2526[1X5.1-1 InstallSCSCPprocedure[101X2728[29X[2XInstallSCSCPprocedure[102X( [3Xprocname[103X, [3Xprocfunc[103X[, [3Xdescription[103X][, [3Xnarg1[103X[, [3Xnarg2[103X][, [3Xsignature[103X]] ) [32X function29[6XReturns:[106X [33X[0;10Ynothing[133X3031[33X[0;0YFor a string [3Xprocname[103X and a function [3Xprocfunc[103X, [2XInstallSCSCPprocedure[102X makes32the [3Xprocfunc[103X available as SCSCP procedure under the name [3Xprocname[103X, adding it33to the transient [5XOpenMath[105X content dictionary [10Xscscp_transient_1[110X that will34exist during the service lifetime.[133X3536[33X[0;0YThe second argument [3Xprocfunc[103X may be either a standard or user-defined [5XGAP[105X37function (procedure, operation, etc.).[133X3839[33X[0;0YThe rest of arguments are optional and may be used in a number of40combinations:[133X4142[30X [33X[0;6Y[3Xdescription[103X is a string with the description of the procedure. It may43be used by the help system. If it is omitted, the procedure will be44reported as undocumented.[133X4546[30X [33X[0;6Y[3Xnarg1[103X is a non-negative integer, specifying the minimal number of47arguments, and [3Xnarg2[103X is a non-negative integer or infinity, specifying48the maximal number of arguments. If [3Xnarg2[103X is omitted then the maximal49number of arguments will be set to [3Xnarg1[103X. If both [3Xnarg1[103X and [3Xnarg2[103X are50omitted then the minimal number of arguments will be set to zero and51their maximal number will be set to infinity.[133X5253[30X [33X[0;6Y[3Xsignature[103X is the signature record of the procedure. If the [3Xsignature[103X54is given, then the number of arguments must be explicitly specified55(by [3Xnarg1[103X with or without [3Xnarg2[103X) at least to zero and infinity56respectively (to ensure proper matching of arguments). Note that it is57completely acceptable for a symbol from a transient content dictionary58to overstate the set of symbols which may occur in its children using59the [10Xscscp2.symbol_set_all[110X symbol, and to use standard [5XOpenMath[105X errors60to reject requests later at the stage of their evaluation. For61example, using such approach, we will define the procedure62[10XWS_Factorial[110X accepting not only immediate [10X<OMI>[110X objects but anything63which could be evaluated to an integer.[133X6465[33X[0;6Y. The signature must be either a list of records, where [22Xi[122X-th record66corresponds to the [22Xi[122X-th argument, or a record itself meaning that it67specifies the signature for all arguments. In the latter case the68record may be [10Xrec( )[110X corresponding to the [10Xscscp2.symbol_set_all[110X symbol69(this will be assumed by default if the signature will be omitted).[133X7071[33X[0;6YIf more detailed description of allowed arguments is needed, the72signature record (one for all arguments or a specific one) may have73components [10XCDgroups[110X, [10XCDs[110X and [10XSymbols[110X. The first two are lists of names74of content dictionary groups and content dictionaries, and the third75is a record whose components are names of content dictionaries,76containing lists of names of allowed symbols from these77dictionaries,for example:[133X7879[4X [32X Example [32X[104X80[4X[28X[128X[104X81[4X[28Xsignature := rec( CDgroups := [ "scscp" ],[128X[104X82[4X[28X CDs := [ "arith1", "linalg1" ],[128X[104X83[4X[28X Symbols := rec( polyd1 := [ "DMP", "term", "SDMP" ],[128X[104X84[4X[28X polyu := [ "poly_u_rep", "term" ] ) );[128X[104X85[4X[28X[128X[104X86[4X[32X[104X8788[33X[0;0YIn the following example we define the function [10XWS_Factorial[110X that takes an89integers and returns its factorial, using only mandatory arguments of90[2XInstallSCSCPprocedure[102X:[133X9192[4X[32X Example [32X[104X93[4X[28X[128X[104X94[4X[25Xgap>[125X [27XInstallSCSCPprocedure( "WS_Factorial", Factorial );[127X[104X95[4X[28XInstallSCSCPprocedure : procedure WS_Factorial installed. [128X[104X96[4X[28X[128X[104X97[4X[32X[104X9899[33X[0;0YIn the following example we install the procedure that will accept a list of100permutations and return the number in the [5XGAP[105X Small Groups library of the101group they generate (for the sake of simplicity we omit tests of validity of102arguments, availability of [10XIdGroup[110X for groups of given order etc.)[133X103104[4X[32X Example [32X[104X105[4X[28X[128X[104X106[4X[25Xgap>[125X [27XIdGroupByGenerators:=function( permlist )[127X[104X107[4X[25X>[125X [27Xreturn IdGroup( Group( permlist ) );[127X[104X108[4X[25X>[125X [27Xend;[127X[104X109[4X[28Xfunction( permlist ) ... end[128X[104X110[4X[25Xgap>[125X [27XInstallSCSCPprocedure( "GroupIdentificationService", IdGroupByGenerators );[127X[104X111[4X[28XInstallSCSCPprocedure : procedure GroupIdentificationService installed. [128X[104X112[4X[28X[128X[104X113[4X[32X[104X114115[33X[0;0YAfter installation, the procedure may be reinstalled, if necessary:[133X116117[4X[32X Example [32X[104X118[4X[28X[128X[104X119[4X[25Xgap>[125X [27XInstallSCSCPprocedure( "WS_Factorial", Factorial );[127X[104X120[4X[28XWS_Factorial is already installed. Do you want to reinstall it [y/n]? y[128X[104X121[4X[28XInstallSCSCPprocedure : procedure WS_Factorial reinstalled. [128X[104X122[4X[28X[128X[104X123[4X[32X[104X124125[33X[0;0YFinally, some examples of various combinations of optional arguments:[133X126127[4X[32X Example [32X[104X128[4X[28X[128X[104X129[4X[28XInstallSCSCPprocedure( "WS_Phi", Phi, [128X[104X130[4X[28X "Euler's totient function, see ?Phi in GAP", 1, 1 );[128X[104X131[4X[28XInstallSCSCPprocedure( "GroupIdentificationService", [128X[104X132[4X[28X IdGroupByGenerators, 1, infinity, rec() );[128X[104X133[4X[28XInstallSCSCPprocedure( "IdGroup512ByCode", IdGroup512ByCode, 1 );[128X[104X134[4X[28XInstallSCSCPprocedure( "WS_IdGroup", IdGroup, "See ?IdGroup in GAP" );[128X[104X135[4X[28X[128X[104X136[4X[32X[104X137138[33X[0;0YNote that it is quite acceptable to overstate the signature of the procedure139and use only mandatory arguments in a call to [2XInstallSCSCPprocedure[102X, which140will be installed then as a procedure that can accept arbitrary number of141arguments encoded without any restrictions on [5XOpenMath[105X symbols used, because142anyway the [5XGAP[105X system will return an error in case of the wrong number or143type of arguments, though it might be a good practice to give a way to the144client to get more precise procedure description a priori, that is before145sending request. See [14X5.3[114X about utilities for obtaining such information146about the [5XSCSCP[105X service.[133X147148[33X[0;0YSome more examples of installation of SCSCP procedures are given in the file149[11Xscscp/example/myserver.g[111X.[133X150151[1X5.1-2 OMsymRecord[101X152153[29X[2XOMsymRecord[102X[32X global variable154155[33X[0;0YThis is the global record from the [5XOpenMath[105X package used for the conversion156from [5XOpenMath[105X to [5XGAP[105X. It is extended in the [5XSCSCP[105X package by adding support157for symbols from [10Xscscp1[110X and [10Xscscp2[110X content dictionaries ([FHK+a], [FHK+c]).158Additionally, [2XInstallSCSCPprocedure[102X ([14X5.1-1[114X) adds to this record a component159corresponding to the appropriate transient content dictionary (by default,160[10Xscscp_transient_1[110X) defining mappings between [5XOpenMath[105X symbols from this161content dictionary and installed [5XSCSCP[105X procedures.[133X162163164[1X5.2 [33X[0;0YStarting SCSCP server[133X[101X165166[1X5.2-1 RunSCSCPserver[101X167168[29X[2XRunSCSCPserver[102X( [3Xservertype[103X, [3Xport[103X ) [32X function169[6XReturns:[106X [33X[0;10Ynothing[133X170171[33X[0;0YWill start the [5XSCSCP[105X server at port given by the integer [3Xport[103X. The first172parameter [3Xservertype[103X is either [9Xtrue[109X, [9Xfalse[109X or a string containing the server173hostname:[133X174175[30X [33X[0;6Ywhen [3Xservertype[103X is [9Xtrue[109X, the server will be started in a [21Xuniversal[121X176mode and will accept all incoming connections;[133X177178[30X [33X[0;6Ywhen [3Xservertype[103X is [9Xfalse[109X, the server will be started at [11Xlocalhost[111X and179will not accept any incoming connections from outside;[133X180181[30X [33X[0;6Ywhen [3Xservertype[103X is a string, for example, [11X"scscp.gap-system.org"[111X, the182server will be accessible only by specified server name (this may be183useful to manage accessibility if, for example, the hardware has184several network interfaces).[133X185186[4X[32X Example [32X[104X187[4X[28X[128X[104X188[4X[25Xgap>[125X [27XRunSCSCPserver( "localhost", 26133 );[127X[104X189[4X[28XReady to accept TCP/IP connections at localhost:26133 ...[128X[104X190[4X[28XWaiting for new client connection at localhost:26133 ...[128X[104X191[4X[28X[128X[104X192[4X[32X[104X193194[33X[0;0YActually, there is more than one way to run [5XGAP[105X [5XSCSCP[105X server:[133X195196[30X [33X[0;6Yfrom the [5XGAP[105X session as shown in the example above;[133X197198[30X [33X[0;6Ystarting [5XGAP[105X as [10Xgap myserver.g[110X, where [11Xmyserver.g[111X is the server199configuration file with the last command being the call200[2XRunSCSCPserver[102X, which may take its arguments from the configuration201file [11Xscscp/config.g[111X (an example of such configuration file is given in202[11Xscscp/example/myserver.g[111X );[133X203204[30X [33X[0;6Ystart [5XGAP[105X as a daemon using the script [11Xgapd.sh[111X which is supplied in205the root directory of the package (for the description of all206available options see comments in [11Xgapd.sh[111X) and may overwrite207parameters from [11Xscscp/config.g[111X.[133X208209[33X[0;0YSee Section [14X2.2[114X about configuring files [11Xconfig.g[111X and [11Xgapd.sh[111X.[133X210211212[1X5.3 [33X[0;0YProcedures to get information about the [5XSCSCP[105X[101X[1X server[133X[101X213214[1X5.3-1 GetServiceDescription[101X215216[29X[2XGetServiceDescription[102X( [3Xserver[103X, [3Xport[103X ) [32X function217[6XReturns:[106X [33X[0;10Yrecord[133X218219[33X[0;0YReturns the record with three components containing strings with the name,220version and description of the service as specified by the service provider221in the [11Xscscp/config.g[111X (for details about configuration files, see [14X2.2[114X).[133X222223[4X[32X Example [32X[104X224[4X[28X[128X[104X225[4X[25Xgap>[125X [27XGetServiceDescription( "localhost", 26133 );[127X[104X226[4X[28Xrec( [128X[104X227[4X[28X description := "Started with the configuration file scscp/example/myserver.g\[128X[104X228[4X[28X on Thu 16 Feb 2017 16:03:56 GMT", service_name := "GAP SCSCP service", [128X[104X229[4X[28X version := "GAP 4.8.6 + SCSCP 2.2.1" )[128X[104X230[4X[28X[128X[104X231[4X[32X[104X232233[1X5.3-2 GetAllowedHeads[101X234235[29X[2XGetAllowedHeads[102X( [3Xserver[103X, [3Xport[103X ) [32X function236[6XReturns:[106X [33X[0;10Yrecord[133X237238[33X[0;0YReturns the record with components corresponding to content dictionaries.239The name of each component is the name of the content dictionary, and its240the value is either a boolean or a list of strings. In case it's value is a241list, it contains names of symbols from the corresponding content dictionary242which are allowed to appear as a [21Xhead[121X symbol (i.e. the first child of the243outermost [10X<OMA>[110X) in an [5XSCSCP[105X procedure call to the [5XSCSCP[105X server running at244[3Xserver[103X[10X:[110X[3Xport[103X. If it's value is [9Xtrue[109X, it means the server allows all symbols245from the corresponding content dictionary.[133X246247[33X[0;0YNote that it is acceptable (although not quite desirable) for a server to248[21Xoverstate[121X the set of symbols it accepts and use standard [5XOpenMath[105X errors to249reject requests later.[133X250251[4X[32X Example [32X[104X252[4X[28X[128X[104X253[4X[25Xgap>[125X [27XGetAllowedHeads("localhost",26133);[127X[104X254[4X[28Xrec( scscp_transient_1 := [ "AClosestVectorCombinationsMatFFEVecFFE", [128X[104X255[4X[28X "Determinant", "GroupIdentificationService", [128X[104X256[4X[28X "IO_UnpickleStringAndPickleItBack", "IdGroup512ByCode", "Identity", [128X[104X257[4X[28X "IsPrimeInt", "Length", "MathieuGroup", "MatrixGroup", [128X[104X258[4X[28X "NormalizedUnitCFcommutator", "NormalizedUnitCFpower", [128X[104X259[4X[28X "NrConjugacyClasses", "NrSmallGroups", "NumberCFGroups", [128X[104X260[4X[28X "NumberCFSolvableGroups", "PointImages", "QuillenSeriesByIdGroup", [128X[104X261[4X[28X "ResetMinimumDistanceService", "SCSCPStartTracing", "SCSCPStopTracing", [128X[104X262[4X[28X "Size", "SylowSubgroup", "WS_AlternatingGroup", "WS_AutomorphismGroup", [128X[104X263[4X[28X "WS_ConwayPolynomial", "WS_Factorial", "WS_FactorsCFRAC", [128X[104X264[4X[28X "WS_FactorsECM", "WS_FactorsMPQS", "WS_FactorsPminus1", [128X[104X265[4X[28X "WS_FactorsPplus1", "WS_FactorsTD", "WS_IdGroup", "WS_LatticeSubgroups",[128X[104X266[4X[28X "WS_Mult", "WS_MultMatrix", "WS_Phi", "WS_PrimitiveGroup", [128X[104X267[4X[28X "WS_SmallGroup", "WS_SymmetricGroup", "WS_TransitiveGroup", "addition" [128X[104X268[4X[28X ] )[128X[104X269[4X[28X[128X[104X270[4X[32X[104X271272[1X5.3-3 IsAllowedHead[101X273274[29X[2XIsAllowedHead[102X( [3Xcd[103X, [3Xsymbol[103X, [3Xserver[103X, [3Xport[103X ) [32X function275[6XReturns:[106X [33X[0;10Y[9Xtrue[109X or [9Xfalse[109X[133X276277[33X[0;0YChecks whether the [5XOpenMath[105X symbol [3Xcd[103X[10X.[110X[3Xsymbol[103X, which may be a symbol from a278standard or transient [5XOpenMath[105X content dictionary, is allowed to appear as279[21Xhead[121X symbol (i.e. the first child of the outermost [10X<OMA>[110X in an [5XSCSCP[105X280procedure call to the [5XSCSCP[105X server running at [3Xserver[103X[10X:[110X[3Xport[103X. This enables the281client to check whether a particular symbol is allowed without requesting282the full list of symbols.[133X283284[33X[0;0YAlso, it is acceptable (although not necessarily desirable) for a server to285[21Xoverstate[121X the set of symbols it accepts and use standard [5XOpenMath[105X errors to286reject requests later.[133X287288[4X[32X Example [32X[104X289[4X[28X[128X[104X290[4X[25Xgap>[125X [27XIsAllowedHead( "permgp1", "group", "localhost", 26133 );[127X[104X291[4X[28Xtrue[128X[104X292[4X[25Xgap>[125X [27XIsAllowedHead( "setname1", "Q", "localhost", 26133 );[127X[104X293[4X[28Xtrue[128X[104X294[4X[25Xgap>[125X [27XIsAllowedHead( "setname1", "R", "localhost", 26133 );[127X[104X295[4X[28Xfalse[128X[104X296[4X[28X[128X[104X297[4X[32X[104X298299[1X5.3-4 GetTransientCD[101X300301[29X[2XGetTransientCD[102X( [3Xtransient_cd[103X, [3Xserver[103X, [3Xport[103X ) [32X function302[6XReturns:[106X [33X[0;10Yrecord[133X303304[33X[0;0YReturns a record with the transient content dictionary [3Xtransient_cd[103X from the305[5XSCSCP[105X server running at [3Xserver[103X[10X:[110X[3Xport[103X. Names of components of this record306correspond to symbols from the [10Xmeta[110X content dictionary.[133X307308[33X[0;0YBy default, the name of the transient content dictionary for the [5XGAP[105X [5XSCSCP[105X309server is [10Xscscp_transient_1[110X. Other systems may use transient content310dictionaries with another names, which, however, must always begin with311[10Xscscp_transient_[110X and may be guessed from the output of [2XGetAllowedHeads[102X312([14X5.3-2[114X).[133X313314[4X[32X Example [32X[104X315[4X[28X[128X[104X316[4X[25Xgap>[125X [27XGetTransientCD( "scscp_transient_1", "localhost", 26133 );[127X[104X317[4X[28Xrec( CDDate := "2017-02-08", [128X[104X318[4X[28X CDDefinitions := [128X[104X319[4X[28X [ rec( Description := "Size is currently undocumented.", Name := "Size" ),[128X[104X320[4X[28X rec( Description := "Length is currently undocumented.", [128X[104X321[4X[28X Name := "Length" ), [128X[104X322[4X[28X rec( Description := "NrConjugacyClasses is currently undocumented.", [128X[104X323[4X[28X Name := "NrConjugacyClasses" ), [128X[104X324[4X[28X...[128X[104X325[4X[28X rec( Description := "MatrixGroup is currently undocumented.", [128X[104X326[4X[28X Name := "MatrixGroup" ) ], CDName := "scscp_transient_1", [128X[104X327[4X[28X CDReviewDate := "2017-02-08", CDRevision := "0", CDStatus := "private", [128X[104X328[4X[28X CDVersion := "0", [128X[104X329[4X[28X Description := "This is a transient CD for the GAP SCSCP service" )[128X[104X330[4X[28X[128X[104X331[4X[32X[104X332333[1X5.3-5 GetSignature[101X334335[29X[2XGetSignature[102X( [3Xtransientcd[103X, [3Xsymbol[103X, [3Xserver[103X, [3Xport[103X ) [32X function336[6XReturns:[106X [33X[0;10Yrecord[133X337338[33X[0;0YReturns a record with the signature of the [5XOpenMath[105X symbol339[3Xtransientcd[103X[10X.[110X[3Xsymbol[103X from a transient [5XOpenMath[105X content dictionary. This record340contains components corresponding to the [5XOpenMath[105X symbol whose signature is341described, the minimal and maximal number of its children (that is, of its342arguments), and symbols which may be used in the [5XOpenMath[105X encoding of its343children. Note that it is acceptable for a symbol from a transient content344dictionary to overstate the set of symbols which may occur in its children345using the [10Xscscp2.symbol_set_all[110X symbol, and use standard [5XOpenMath[105X errors to346reject requests later, like in the example below: using such approach, the347procedure [10XWS_Factorial[110X is defined to accept not only immediate [10X<OMI>[110X objects348but anything which could be evaluated to an integer.[133X349350[4X[32X Example [32X[104X351[4X[28X[128X[104X352[4X[25Xgap>[125X [27XGetSignature("scscp_transient_1","WS_Factorial","localhost",26133);[127X[104X353[4X[28Xrec( maxarg := 1, minarg := 1,[128X[104X354[4X[28X symbol := rec( cd := "scscp_transient_1", name := "WS_Factorial" ),[128X[104X355[4X[28X symbolargs := rec( cd := "scscp2", name := "symbol_set_all" ) )[128X[104X356[4X[28X[128X[104X357[4X[32X[104X358359360361