OKlibrary  0.2.1.6
BasicExamples.mac
Go to the documentation of this file.
```00001 /* Oliver Kullmann, 6.7.2008 (Swansea) */
00002 /* Copyright 2008, 2010 Oliver Kullmann
00003 This file is part of the OKlibrary. OKlibrary is free software; you can redistribute
00004 it and/or modify it under the terms of the GNU General Public License as published by
00005 the Free Software Foundation and included in this library; either version 3 of the
00006 License, or any later version. */
00007
00023 /* ********************
00024    * Small semigroups *
00025    ********************
00026 */
00027
00028 /* The empty semigroup: */
00029 empty_sgr : [{},lambda([x,y],unknown)]\$
00030
00031 /* The (standardised) 1-element semigroup: */
00032 singleton_sgr : [{1}, lambda([x,y],1)]\$
00033 singleton_mon : [{1}, lambda([x,y],1), 1]\$
00034
00035
00036 /* *******************
00037    * Null semigroups *
00038    *******************
00039 */
00040
00041 /* The constant semigroup (with x0 as null element): */
00042 null_sgr(X,x0) := [X,buildq([x0],lambda([x,y],x0))]\$
00043
00044 /* The left-zero and the right-zero semigroups: */
00045 leftnull_compo : lambda([x,y],x)\$
00046 rightnull_compo : lambda([x,y],y)\$
00047 leftnull_sgr(X) := [X,leftnull_compo]\$
00048 rightnull_sgr(X) := [X,rightnull_compo]\$
00049
00050
00051 /* *********************
00052    * Cyclic semigroups *
00053    *********************
00054 */
00055
00056 /* Prerequisite: index, period natural numbers >= 1. */
00057 cyclic_sgr(index,period) := block([n : index+period-1, V],
00058  V : setn(n),
00059  buildq([V,index,period],
00060         [V, lambda([a,b], block([s:a+b],
00061           if s <= index then s
00062           else index + mod(s - index, period)))]))\$
00063
```