############################################################################# 
## 
#W  gpd.gd                    GAP4 package `Gpd'                Chris Wensley 
#W                                                               & Emma Moore
##
#H  @(#)Id: "gpd/gap/gpd.gd", v.1.05 2008/11/21  
## 
##  Declaration file for functions in the Gpd package.
##
Revision.("gpd/gap/gpd_gd") :=
             "@(#)$Id: gpd.gd,v 1.05 2008/11/21 gap Exp $";

############################################################################## 
## 
#P  IsGroupoid( <gpd> )                
## 
##  A groupoid can be various things.
## 
## (11/03/08) replaced Property with Category/Synonym in the following: 
## DeclareProperty( "IsGroupoid", IsMathCat and
##     IsMultiplicativeElementWithInverseCollection ); 

##  DeclareSynonym( "IsGroupoid", IsMathCat and 
##                       IsMultiplicativeElementWithInverseCollection );
DeclareSynonymAttr( "IsGroupoid", 
    IsMagmaWithObjectsAndInverses and IsAssociative );

############################################################################# 
## 
#O  ObjectsOfGroupoid( <gpd> ) 
#O  GeneratorsOfGroupoid( <gpd> )
#O  PiecesOfGroupoid( <gpd> ) 
## 
#?  (03/10/08)  changed these from Attributes to Operations 
#?              and call equivalent MagmaWithObjects attributes
##
DeclareOperation( "ObjectsOfGroupoid", [ IsGroupoid ] );  
DeclareOperation( "GeneratorsOfGroupoid", [ IsGroupoid ] );
DeclareOperation( "PiecesOfGroupoid", [ IsGroupoid ] );  
  
############################################################################## 
## 
#R  IsSinglePieceRaysRep( <gpd> )                
## 
##  A connected groupoid with variable object groups is a wide subgroupoid 
##  of an IsDirectProductWithCompleteGraph with the same objects, and is 
##  determined by a root group, and a set of conjugating elements 
## 
DeclareRepresentation( "IsSinglePieceRaysRep",
  IsGroupoid and IsAttributeStoringRep and IsComponentObjectRep, 
  [ "parent", "rootGroup", "rayConjugators" ] ); 
 
############################################################################# 
## 
#P  IsPermGroupoid( <gpd> )                                    
#P  IsFpGroupoid( <gpd> )                                    
#P  IsPcGroupoid( <gpd> )                                    
#P  IsFreeGroupoid( <gpd> )                                    
## 
DeclareProperty( "IsPermGroupoid", IsGroupoid );  
DeclareProperty( "IsFpGroupoid", IsGroupoid );  
DeclareProperty( "IsPcGroupoid", IsGroupoid );  
DeclareProperty( "IsFreeGroupoid", IsGroupoid );  
  
############################################################################# 
## 
#F  Groupoid( <args> )              
## 
DeclareGlobalFunction( "Groupoid" );

############################################################################# 
##           
#O  SinglePieceGroupoidNC( <group>, <objects> )              
#O  SinglePieceGroupoid( <group>, <objects> )              
#O  SinglePieceGroupoidWithRaysNC( <parent>, <rootgp>, <conj> )
#O  SinglePieceGroupoidWithRays( <parent>, <rootgp>, <conj> )
#O  SinglePieceGroupoidByGenerators( <gens> )
## 
DeclareOperation( "SinglePieceGroupoidNC", 
    [ IsGroup, IsHomogeneousList ] ); 
DeclareOperation( "SinglePieceGroupoid", 
    [ IsGroup, IsHomogeneousList ] ); 
DeclareOperation( "SinglePieceGroupoidWithRaysNC", 
    [ IsGroupoid, IsGroup, IsHomogeneousList ] );
DeclareOperation( "SinglePieceGroupoidWithRays", 
    [ IsGroupoid, IsGroup, IsHomogeneousList ] );
DeclareOperation( "SinglePieceGroupoidByGenerators", 
    [ IsHomogeneousList ] ); 

############################################################################# 
## 
#O  GroupAsGroupoid( <obj>, <grp> )
#O  GroupoidByUnionNC( <comps> )              
#O  GroupoidByUnion( <comps> )              
## 
##  DeclareOperation( "GroupAsGroupoid", [ IsScalar, IsGroup ] );    
##  DeclareOperation( "GroupoidByUnionNC", [ IsHomogeneousList ] );    
##  DeclareOperation( "GroupoidByUnion", [ IsList ] );
 
############################################################################# 
## 
#O  PieceOfObject( <gpd>, <obj> )                                    
#O  PieceNrOfObject( <gpd>, <obj> )                                    
## 
##  DeclareOperation( "PieceOfObject", [ IsGroupoid, IsScalar ] );  
##  DeclareOperation( "PieceNrOfObject", [ IsGroupoid, IsScalar ] );  
  
############################################################################# 
##                         
#O  ObjectGroup( <gpd>, <obj> )
#A  ObjectGroups( <gpd> )
## 
DeclareOperation( "ObjectGroup", [ IsGroupoid, IsScalar ] );    
DeclareAttribute( "ObjectGroups", IsGroupoid );    

## ======================================================================== ##
##                            Groupoid Elements                             ##
## ======================================================================== ##

############################################################################## 
## 
##  A connected groupoid element is [ group element, source, target ]
##
#P  IsGroupoidElement
#R  IsGroupoidElementRep
## 
DeclareProperty( "IsGroupoidElement", IsMultiplicativeElement ); 
DeclareRepresentation( "IsGroupoidElementRep",
    IsGroupoidElement and IsPositionalObjectRep, [ 1, 2, 3 ] ); 
#?  NB: these two are declared here so that the methods in gpd.gi can stay - 
#?      but it is not intended that these functions sh0uold be used!

############################################################################## 
## 
#O  GroupoidElementNC( <elt, src, tgt> ) 
#O  GroupoidElement( <gpd, elt, src, tgt> ) 
## 
##  A connected groupoid element is [ group element, source, target ]
## 
DeclareOperation( "GroupoidElementNC", 
    [ IsMultiplicativeElement, IsScalar, IsScalar ] ); 
DeclareOperation( "GroupoidElement",
    [ IsGroupoid, IsMultiplicativeElement, IsScalar, IsScalar ] ); 
#?  NB: these two are declared here so that the methods in gpd.gi can stay - 
#?      but it is not intended that these functions sh0uold be used!

############################################################################## 
## 
##  Stars, Costars and Homsets are particular subsets of the elements
##  of a connected groupoid for which an iterator is required
##  
##  Six items of data are required: 
##  1.  the family of objects of the parent groupoid, 
##  2.  a set of group elements, e.g. an object group, 
##  3.  a list of source objects, 
##  4.  a list of target objects, 
##  5.  a list of rays, 
##  6.  a single character string "c" with c in {s,c,h,u,r,l,d}, 
##      specifying star; costar; homset; union; right/left/double coset.
##
#P  IsHomsetCosets( <obj> )
#R  IsHomsetCosetsRep( <obj> )
##  #A  UnionHomsets( <gpd> )                     #? not needed (12/09/08) 
#O  IdentityElement( <gpd>, <obj> ) 
#O  ObjectStarNC( <gpd>, <obj> ) 
#O  ObjectStar( <gpd>, <obj> ) 
#O  ObjectCostarNC( <gpd>, <obj> ) 
#O  ObjectCostar( <gpd>, <obj> ) 
#O  HomsetNC( <gpd>, <obj1>, <obj2> ) 
#O  Homset( <gpd>, <obj1>, <obj2> ) 
#A  ElementsOfGroupoid( <gpd> ) 
##
DeclareProperty( "IsHomsetCosets", IsMultiplicativeElementCollection );
DeclareRepresentation( "IsHomsetCosetsRep", 
    IsHomsetCosets and IsPositionalObjectRep, [1..6] ); 
## DeclareAttribute( "UnionHomsets", IsGroupoid );
DeclareOperation( "IdentityElement", [ IsGroupoid, IsScalar ] ); 
DeclareOperation( "ObjectStarNC", [ IsGroupoid, IsScalar ] ); 
DeclareOperation( "ObjectStar", [ IsGroupoid, IsScalar ] ); 
DeclareOperation( "ObjectCostarNC", [ IsGroupoid, IsScalar ] ); 
DeclareOperation( "ObjectCostar", [ IsGroupoid, IsScalar ] ); 
DeclareOperation( "HomsetNC", [ IsGroupoid, IsScalar, IsScalar ] ); 
DeclareOperation( "Homset", [ IsGroupoid, IsScalar, IsScalar ] ); 
DeclareAttribute( "ElementsOfGroupoid", IsGroupoid ); 

############################################################################## 
##  
#?  (26/09/08)  RightCosetReps should be RightTransversal ?? 
##
#P  IsGroupoidCoset( <cset> ) 
#A  SuperDomain( <cset> ); 
#A  HomsetCosetsGroupoidCoset( <cset> ) 
#O  RightCosetRepresentatives( <gpd>, <sgpd> )    #? should be Iterator ?? 
#R  IsMyLeftCosetDefaultRep( <gp>, <obj> ) 
#O  LeftCosetRepresentatives( <gpd>, <sgpd> )     #? should be Iterator ?? 
#O  LeftCosetRepresentativesFromObject( <gpd>, <sgpd>, <obj> ) 
#O  LeftCosetsNC( <gpd>, <sgpd> ) 
#O  LeftCoset( <gpd>, <sgpd>, <elt> )
#O  DoubleCosetRepresentatives( <gpd>, <sgpd>, <sgpd> )        #? ditto ?? 
## 
DeclareProperty( "IsGroupoidCoset", IsRightCosetDefaultRep ); 
DeclareAttribute( "SuperDomain", IsRightCosetDefaultRep ); 
DeclareAttribute( "HomsetCosetsGroupoidCoset", IsRightCosetDefaultRep ); 
DeclareCategory( "IsMyLeftCoset", IsDomain and IsExternalOrbit );
DeclareRepresentation( "IsMyLeftCosetDefaultRep", 
    IsComponentObjectRep and IsAttributeStoringRep and IsMyLeftCoset, [] );
DeclareOperation( "RightCosetRepresentatives", [ IsGroupoid, IsGroupoid ] ); 
DeclareOperation( "LeftCosetRepresentatives", [ IsGroupoid, IsGroupoid ] ); 
DeclareOperation( "LeftCosetRepresentativesFromObject", 
    [ IsGroupoid, IsGroupoid, IsScalar ] ); 
DeclareOperation( "LeftCosetsNC", [ IsGroupoid, IsGroupoid ] ); 
DeclareOperation( "LeftCoset", 
    [ IsGroupoid, IsGroupoid, IsMultiplicativeElementWithObjects ] ); 
DeclareOperation( "DoubleCosetRepresentatives", 
    [ IsGroupoid, IsGroupoid, IsGroupoid ] ); 

############################################################################## 
## 
#O  IsElementInGroupoid( <e>, <gpd> ) 
##
##  this takes the place of an implementation of \in 
DeclareOperation( "IsElementInGroupoid", [ IsGroupoidElement, IsGroupoid ] ); 


## ======================================================================== ##
##                               Subgroupoids                               ##
## ======================================================================== ##

############################################################################# 
## 
#F  Subgroupoid( <args> )              
#O  IsSubgroupoid( <G>, <U> )
## 
DeclareGlobalFunction( "Subgroupoid" );
DeclareOperation( "IsSubgroupoid", [ IsGroupoid, IsGroupoid ] );

############################################################################# 
## 
#O  SubgroupoidBySubgroup( <gpd>, <sgp> ) 
#O  SubgroupoidByPieces( <gpd>, <obhoms> )              
#O  PiecePositions( <gpd>, <sgpd> )
#O  DiscreteSubgroupoid( <gpd>, <obs>, <gps> )              
#A  MaximalDiscreteSubgroupoid( <gpd> )  
#O  FullSubgroupoid( <gpd>, <obs> )              
#A  FullIdentitySubgroupoid( <gpd> )  
#A  DiscreteIdentitySubgroupoid( <gpd> )  
## 
DeclareOperation( "SubgroupoidBySubgroup", 
    [ IsGroupoid and IsDirectProductWithCompleteGraph, IsGroup ] ); 
DeclareOperation( "SubgroupoidByPieces",
    [ IsGroupoid, IsHomogeneousList ] );
##  DeclareOperation( "PiecePositions", [ IsGroupoid, IsGroupoid ] );
DeclareOperation( "DiscreteSubgroupoid",
    [ IsGroupoid, IsHomogeneousList, IsHomogeneousList ] );
DeclareAttribute( "MaximalDiscreteSubgroupoid", IsGroupoid );
DeclareOperation( "FullSubgroupoid", [ IsGroupoid, IsHomogeneousList ] );
DeclareAttribute( "FullIdentitySubgroupoid", IsGroupoid );
DeclareAttribute( "DiscreteIdentitySubgroupoid", IsGroupoid );

############################################################################## 
## 
#O  IsWideSubgroupoid( <gpd>, <sgpd> )                
##  #P  IsDiscreteGroupoid( <gpd> )                
## 
DeclareOperation( "IsWideSubgroupoid", [ IsGroupoid, IsGroupoid ] ); 
##  DeclareProperty( "IsDiscreteGroupoid", IsGroupoid ); 

#############################################################################
##
#O  ConjugateGroupoid( <gpd>, <elt> ) . . . . . . conjugate of <gpd> by <elt>
#O  ConjugateSubgroupoid( <gpd>, <elt> ) . . . . conjugate of <gpd> by <elt>
##
##  DeclareOperation( "ConjugateGroupoid", [ IsGroupoid, IsGroupoidElement ] );
##  DeclareOperation( "ConjugateSubgroupoid",
##      [ IsGroupoid and HasParent, IsGroupoidElement ] );

#############################################################################
##
#O  ConjugateGroupoidElement( <x>, <y> ) . . . . groupoid conjugate of x by y
## 
#?  should be restricted to groupoid elements ??
DeclareOperation( "ConjugateGroupoidElement", 
    [IsMultiplicativeElementWithObjects,IsMultiplicativeElementWithObjects] );

############################################################################## 
## 
#E  gpd.gd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ends here 
## 
