RAQ/lib/structure.gd

214 lines
9.5 KiB
GDScript3
Raw Normal View History

## structure.gd RAQ Definitions, generation, and elementary ops and props.
## GAP Categories and representations
#! @Chapter technical
#! This chapter covers computational/operational aspects of &RAQ;
#! rather than mathematical ones.
#! @Section Messages
#! @Description Controls the level of verbosity of &RAQ;'s informative
#! messages. Use `SetInfoLevel` to set it to 0 to quiet &RAQ;
#! entirely, or to values greater than 1 to yield more details of &RAQ;'s
#! internal algorithms.
2017-10-22 16:23:45 +00:00
DeclareInfoClass("InfoRAQ");
## Self-distributivity
# Note these are properties that can and therefore should be defined just at
# the level of MultiplicativeElements and Magmas, hence although the LOOPS
# package defines IsLDistributive and IsRDistributive for quasigroups, they
# would be ambiguous in the case of something like a semiring whose
# multiplicative structure was a quasigroup
# (cf. https://arxiv.org/abs/0910.4760). Hence, we implement them in RAQ with
# new, non-conflicting terms.
#! @Chapter basic
#! In order to build up and define one-sided quasigroups, racks, and
#! quandles, &RAQ; must define several lower-level objects and properties,
#! which are documented in this section. Although logically they come before
#! the domain constructors and operations, they are presented afterwards
#! because it's rare that one needs to use them directly when working with
#! &RAQ;.
#! @Section elements
#! @SectionTitle Categories of elements
#! @Description An element <C>x</C> with the property
#! that for all elements <C>y</C> and <C>z</C> in its family, <C>x*(y*z) =
#! (x*y)*(x*z)</C>.
DeclareCategory("IsLSelfDistElement", IsMultiplicativeElement);
# Have to skip a line because of AutoDoc's convention on documenting
# consecutive declarations.
DeclareCategoryCollections("IsLSelfDistElement");
#! @Description An element <C>x</C> with the property
#! that for all elements <C>y</C> and <C>z</C> in its family, <C>(y*z)*x =
#! (y*x)*(z*x)</C>.
DeclareCategory("IsRSelfDistElement", IsMultiplicativeElement);
DeclareCategoryCollections("IsRSelfDistElement");
#! @Section collections
#! @SectionTitle Categories of collections
#! @Description A collection which satisfies the left self-distributive
#! property (see the description of
#! <Ref Filt="IsLSelfDistElement" Label="for IsMultiplicativeElement"/>)
#! for all triples of elements of the collection.
DeclareProperty("IsLSelfDistributive", IsMultiplicativeElementCollection);
InstallTrueMethod(IsLSelfDistributive, IsLSelfDistElementCollection);
#! @Description A collection which satisfies the right self-distributive
#! property (see the description of
#! <Ref Filt="IsRSelfDistElement" Label="for IsMultiplicativeElement"/>)
#! for all triples of elements of the collection.
DeclareProperty("IsRSelfDistributive", IsMultiplicativeElementCollection);
InstallTrueMethod(IsRSelfDistributive, IsRSelfDistElementCollection);
## Idempotence
# There is already a property IsIdempotent on elements, but to define
# structures which will automatically be quandles we need a corresponding
# collections category:
DeclareCategoryCollections("IsIdempotent");
# Collections in which every element is idempotent
#! @Description A collection in which every element <C>x</C> is
#! **idempotent**, i.e. satisfies <C>x*x=x</C>.
DeclareProperty("IsElementwiseIdempotent", IsMultiplicativeElementCollection);
InstallTrueMethod(IsElementwiseIdempotent, IsIdempotentCollection);
#! @Description Tests whether <A>obj</A> is a left rack, which by definition
#! is precisely that <A>obj</A> is a left quasigroup (i.e.,
#! <C>IsLeftQuasigroup(obj)</C>, defined in the &LOOPS;
#! package, is true) and is left self-distributive
#! (i.e., <C>IsLSelfDistributive(obj)</C> is true).
#! @Arguments obj
#! @ItemType Filt
DeclareSynonym("IsLeftRack", IsLeftQuasigroup and IsLSelfDistributive);
#! @Description Tests whether <A>obj</A> is a right rack, by definition
#! precisely that it is a right quasigroup and right self-distributive.
#! @Arguments obj
#! @ItemType Filt
DeclareSynonym("IsRightRack", IsRightQuasigroup and IsRSelfDistributive);
#! @Description Tests whether <A>obj</A> is a left quandle, which by definition
#! is precisely that <A>obj</A> is a left rack (i.e.,
#! <C>IsLeftRack(obj)</C> is true) and every element is idempotent
#! (i.e., <C>IsElementwiseIdempotent(obj)</C> is true).
#! @Arguments obj
#! @ItemType Filt
DeclareSynonym("IsLeftQuandle", IsLeftRack and IsElementwiseIdempotent);
#! @Description Tests whether <A>obj</A> is a right quandle, by definition
#! precisely that it is a right rack and every element is idempotent.
#! @Arguments obj
#! @ItemType Filt
DeclareSynonym("IsRightQuandle", IsRightRack and IsElementwiseIdempotent);
#! @Chapter construct
#! @Section from_scratch
#! @SectionTitle Direct constructors
#! All of the functions in this section produce magmas (of one of the
#! categories with which &RAQ; is concerned) from data of other (non-domain)
#! types.
#! @BeginAutoDoc
#! @BeginGroup basic_constructors
#! @GroupTitle Basic constructors (from generators)
#! @Description These are the fundamental constructors of these
#! categories. They produce the closure of the specified <A>generators</A>,
#! which are considered to be of the given <A>family</A>, under both the
#! binary operation of the magma, which is always considered to be * in
#! &RAQ;, and the quotient on the specified side. (If
#! <A>family</A> is omitted, these functions attempt to infer it from the
#! <A>generators</A>; if there are no <A>generators</A> then the
#! <A>family</A> must be specified, and note that the resulting magma will
#! be empty.) The resulting magma must satisfy the defining
#! characteristics of the respective category: for the quasigroups, all
#! quotients on the specified side must exist; racks must also satisfy the
#! appropriate self-distributive law; and quandles must also have every
#! element idempotent.
#! @Returns a magma of the named category
#! @GroupInitialArguments [family], [generators]
DeclareGlobalFunction("LeftQuasigroup");
DeclareGlobalFunction("RightQuasigroup");
DeclareGlobalFunction("LeftRack");
DeclareGlobalFunction("RightRack");
DeclareGlobalFunction("LeftQuandle");
DeclareGlobalFunction("RightQuandle");
#! @EndGroup
#! @BeginGroup unchecked_basic_constructors
#! @GroupTitle Unchecked basic constructors
#! @Description Each function is the same as its checked counterpart, but the
#! <A>family</A> of elements must be specified and no checks that the
#! appropriate axioms are satisfied are performed. They may be used for
#! efficiency when those properties are guaranteed to be satisfied by the
#! <A>generators</A>. NOTE that the behavior of &RAQ; is undefined if the
#! unchecked versions are called on <A>generators</A> that do **not**
#! satisfy the proper axioms.
#! @Returns a magma of the named category
#! @GroupInitialArguments family, generators
DeclareGlobalFunction("LeftQuasigroupNC");
DeclareGlobalFunction("RightQuasigroupNC");
DeclareGlobalFunction("LeftRackNC");
DeclareGlobalFunction("RightRackNC");
DeclareGlobalFunction("LeftQuandleNC");
DeclareGlobalFunction("RightQuandleNC");
#! @EndGroup
#! @EndAutoDoc
# Underlying operation
DeclareGlobalFunction("CloneOfTypeByGenerators");
2017-10-22 16:23:45 +00:00
## Opposite structures
#! @Section from_quasigroups
#! @SectionTitle Constructors from other one-sided quasigroups
#! All of the functions in this section produce magmas from other objects of
#! similar domain categories.
2017-10-22 16:23:45 +00:00
DeclareCategory("IsOppositeObject", IsMultiplicativeElement);
DeclareCategoryCollections("IsOppositeObject");
DeclareAttribute("OppositeFamily", IsFamily);
DeclareAttribute("OppositeType", IsFamily);
DeclareSynonym("IsDefaultOppositeObject",
IsOppositeObject and IsPositionalObjectOneSlotRep);
DeclareAttribute("OppositeObj", IsMultiplicativeElement);
DeclareAttribute("UnderlyingMultiplicativeElement", IsOppositeObject);
#! @Chapter operate
#! @Section basic_info
#! @SectionTitle Basic information
# Attributes for the generators
#! @Arguments q
#! @Returns list of elements generating <A>q</A>
#! @Description This produces a list of elements that generate <A>q</A> by
#! `\*` and `LeftQuotient`. There are no guarantees that the list is minimal
#! in any respect. Note that for finite structures, the
#! `GeneratorsOfMagma(q)` will suffice, but in general more
#! elements might be required to generate the structure just under `\*`.
DeclareAttribute("GeneratorsOfLeftQuasigroup", IsLeftQuasigroup);
#! @Arguments q
#! @Returns list of elements generating <A>q</A>
#! @Description This produces a list of elements that generate <A>q</A> by
#! `\*` and `\/`, with the same caveats as above.
DeclareAttribute("GeneratorsOfRightQuasigroup", IsRightQuasigroup);
## Conversions into quasigroup/rack/quandle
#! @Chapter construct
#! @Section from_scratch
#! @BeginAutoDoc
#! @BeginGroup conversions
#! @GroupTitle Conversions
#! @Description These functions convert a potentially arbitrary
#! <A>collection</A> of elements to one of the categories of objects with
#! which &RAQ; is concerned. The <A>collection</A> must be closed under *
#! and satisfy the appropriate axioms for the conversion to succeed.
#! @Returns a magma of the named category
#! @GroupInitialArguments collection
DeclareAttribute("AsLeftQuasigroup", IsCollection);
DeclareAttribute("AsLeftRack", IsCollection);
DeclareAttribute("AsLeftQuandle", IsCollection);
DeclareAttribute("AsRightQuasigroup", IsCollection);
DeclareAttribute("AsRightRack", IsCollection);
DeclareAttribute("AsRightQuandle", IsCollection);
#! @EndGroup
#! @EndAutoDoc