Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

/magnus/back_end/Group/include/FPGroup.h

Go to the documentation of this file.
00001 /*
00002  *   $Id: FPGroup.h,v 1.7 2000/02/09 23:58:06 bormotov Exp $
00003  */
00004 
00005 // Copyright (C) 1994 The New York Group Theory Cooperative
00006 // See magnus/doc/COPYRIGHT for the full notice.
00007 
00008 // Contents: Definition of the FPGroup class.
00009 //
00010 // Principal Authors: Stephane Collart, Roger Needham
00011 //
00012 // Status: in progress
00013 //
00014 // Revision History:
00015 //
00016 // * 7/96 Dmitry B. made porting to gcc 2.7.2.
00017 //
00018 // Special Notes:
00019 //
00020 //
00021 
00022 #ifndef _FINITELY_PRESENTED_GROUP_H_
00023 #define _FINITELY_PRESENTED_GROUP_H_
00024 
00025 
00026 //#include "FreeGroup.h"
00027 #include "FGGroup.h"
00028 #include "FPGroupRep.h"
00029 #include "File.h"
00030 
00031 class FPGroup : public DerivedObjectOf<FGGroup,FPGroupRep> {
00032 
00033 public:
00034 
00035   ///////////////////////////////////////////////////////
00036   //                                                   //
00037   //  Constructors                                     //
00038   //                                                   //
00039   ///////////////////////////////////////////////////////
00040 
00041   // Copy constructor provided by compiler
00042 
00043   FPGroup( int ngens = 0 ) :
00044     DerivedObjectOf<FGGroup,FPGroupRep>( new FPGroupRep(ngens) ) { }
00045   // To construct a group of given number of unnamed generators and
00046   // no relators. Default ngens = 0 gives trivial group with 0
00047   // generators
00048 
00049   FPGroup( int ngens, const SetOf<Word>& rels ) :
00050     DerivedObjectOf<FGGroup,FPGroupRep>( new FPGroupRep(ngens, rels) ) { }
00051   // To construct a group of given number of unnamed generators and
00052   // given relators.
00053   
00054   FPGroup( const VectorOf<Chars>& gennames ) :
00055     DerivedObjectOf<FGGroup,FPGroupRep>( new FPGroupRep(gennames) ) { }
00056   // To construct a group with named generators, no relators.
00057 
00058   FPGroup( const VectorOf<Chars>& gennames,
00059                                                                   const SetOf<Word>& rels ) :
00060     DerivedObjectOf<FGGroup,FPGroupRep>( new FPGroupRep(gennames, rels) ) { }
00061   // To construct a group with named generators, given relators.
00062 
00063   FPGroup( const Group& G ) : DerivedObjectOf<FGGroup,FPGroupRep>(G) { }
00064   // cast construtor: to cast an arbitrary group as an FP group.
00065   // NB. This rewraps the unchanged representation, hence is in general
00066   // only useful for casting a group known to be an actual FP group.
00067 
00068   // @stc FPGroup( const FreeGroup& G ) :
00069   //    FGGroup(G) { } // @stc bugged constructor
00070   // To make a free group into a finitely presented one.
00071   // @stc if you used this constructor, check your code -- all it did
00072   // was rewrap an Free gp rep as an FP gp.
00073   
00074   // Destructor provided by compiler.
00075 
00076   ///////////////////////////////////////////////////////
00077   //                                                   //
00078   //  Accessors / Modifiers                            //
00079   //                                                   //
00080   ///////////////////////////////////////////////////////
00081   
00082   // Inherited from Group:
00083   //@rn how to do this systematically?
00084   // @stc I don't think there is any proper way to do it systematically,
00085   // any class anywhere may have access adjusters: thus the only way to
00086   // `see' the complete interface in every class is to write it down
00087   // exhaustively; however, each inherited method should be considered
00088   // inherited from its immediate parent, in order not to make the
00089   // validity of the statements here dependent on changes higher up.
00090   // it's probably better to put each method in its proper contextual place
00091 
00092   static Type type( ) { return FPGroupRep::type(); }
00093   // dominates FGGroup::type();
00094 
00095   // Inherited from FGGroup:
00096   //  Type actualType() const; // pseudo-virtual
00097   //  int numberOfGenerators( ) const
00098   //  Chars nameOfGenerator(int i) const
00099   //  VectorOf<Chars> namesOfGenerators( ) const
00100 
00101   SetOf<Word> getRelators( ) const { return look()->relators; }  
00102 
00103   // @stc code of the following incomplete: other flags must be reset
00104   // too:
00105 
00106   SetOf<Word> setRelators( const SetOf<Word>& r ) {
00107         return change()->setRelators(r);
00108   }
00109 
00110   SetOf<Word> addRelators( const SetOf<Word>& r ) {
00111         return change()->addRelators(r);
00112   }
00113 
00114   SetOf<Word> removeRelators( const SetOf<Word>& r ) {
00115         return change()->removeRelators(r);
00116   }
00117 
00118   ///////////////////////////////////////////////////////
00119   //                                                   //
00120   //  Methods dealing with group structure             //
00121   //                                                   //
00122   ///////////////////////////////////////////////////////
00123 
00124   // Inherited from FGGroup:
00125   //  int order( ) const;
00126 
00127   Trichotomy isFree( ) const { return enhance()->isFree(); }
00128   // Returns YES if this group is free on its generators, NO if not,
00129   // and DONTKNOW if no answer can be determined.
00130 
00131   Trichotomy isMetricSmallCancellationGroup( ) const {
00132         computeCancellationLambda();
00133         return look()->isMetricSmallCancellation();
00134   }
00135 
00136   int cancellationLambda( ) const {
00137         computeCancellationLambda();
00138         return look()->isMetricSmallCancellation.lambda();
00139   }
00140 
00141   // @stc these methods for checking whether the group has small
00142   // cancellation are of dubious usefulness, since presumably in 
00143   // general the caller will want to construct symmetrised relations
00144   // to use in making a MSCGroup.
00145 
00146   ///////////////////////////////////////////////////////
00147   //                                                   //
00148   //  Methods which deal with group elements           //
00149   //                                                   //
00150   ///////////////////////////////////////////////////////
00151 
00152   // Inherited from FGGroup:
00153   // Elt makeIdentity( ) const;
00154   // Bool isSyntacticIdentity(const Elt& e) const;
00155   // Trichotomy isTrivialElt( const Elt& e ) const; // pseudo-virtual
00156   // Trichotomy areEqual(const Elt& e1, const Elt& e2) const;
00157   // Elt firstElt( ) const;
00158   // Elt nextElt(const Elt& e) const;
00159   // Elt multiply(const Elt& e1, const Elt& e2) const;
00160   // Elt inverseOf(const Elt& e) const;
00161   // Elt raiseToPower(const Elt& e, int n) const;
00162   // Elt conjugateBy(const Elt& e1, const Elt& e2) const;
00163   // Elt commutator(const Elt& e1, const Elt& e2) const;
00164   // Elt eval( const Word& w ) const;
00165   // Trichotomy wordProblem( const Word& w ) const;
00166   // Trichotomy conjugacyProblem( const Word& u, const Word& v ) const;
00167 
00168   Word shortenByRelators(const Word& w) const {
00169          return look()->shortenByRelators(w);
00170   }
00171   // Shorten w by calling shortenByRelator with relators.
00172   // @stc @rn: this is outdated by @db & @dp's new implementation:
00173           // This does not even symmetrize the relators, much less check a
00174           // small cancellation condition or test hyperbolicity  -- that
00175           // is the caller's responsibility.
00176   // @stc the question of whether to explicitely store symmetrised
00177   // relations or to provide fancy indexing is raised here too
00178   // (see Discussion, MSCGroup.h)
00179 
00180   Chars productOfCommutators(const Word& w,File& file) {
00181     return change()->productOfCommutators(w,file);
00182   }
00183   
00184   Chars productOfSquares(const Word& w,File& file) {
00185     return change()->productOfSquares(w,file);
00186   }
00187 
00188   ///////////////////////////////////////////////////////
00189   //                                                   //
00190   //  Fabricators:                                     //
00191   //                                                   //
00192   ///////////////////////////////////////////////////////
00193 
00194   // Inherited from FGGroup:
00195   //  Subgroup randomSubgroup( ) const;
00196 
00197   ///////////////////////////////////////////////////////
00198   //                                                   //
00199   //  I/O                                              //
00200   //                                                   //
00201   ///////////////////////////////////////////////////////
00202 
00203   // Inherited from FGGroup:
00204 
00205   //  Word readWord(istream& istr, Chars& errMesg) const
00206   //  void printWord( ostream& ostr, const Word& w ) const
00207 
00208   void printRelators(ostream& ostr) const {
00209          look()->printRelators(ostr);
00210   }
00211 
00212  /////////////////////////////////////////////////////////////////////////
00213   //                                                                     //
00214   // IPC tools:                                                          //
00215   //                                                                     //
00216   /////////////////////////////////////////////////////////////////////////
00217   // operators inhereted from Group
00218 
00219 
00220   ///////////////////////////////////////////////////////
00221   //                                                   //
00222   //  Private helper stuff:                            //
00223   //                                                   //
00224   ///////////////////////////////////////////////////////
00225 
00226 private:
00227 
00228   void computeCancellationLambda( ) const {
00229     if ( look()->isMetricSmallCancellation() == DONTKNOW ) {
00230       SetOf<Word> S(getRelators());
00231       enhance()->isMetricSmallCancellation.
00232         setLambda(::cancellationLambda( symmetrise(S) ));
00233     }
00234     // @stc compiler complains about the rvalue tmp here -- need to
00235     // make a work-around to make the compiler shut up.
00236   }
00237   // @stc should the group store a copy of symmetrised relators for
00238   // future use? the question remains even if there is a symmetrised
00239   // words container class.
00240         
00241 protected:
00242  
00243   // Special wrapping constructor to wrap new representations (returned
00244   // by eg. delegated methods) and for base initialisation by derived
00245   // classes:
00246  
00247   FPGroup( FPGroupRep* newrep ) : DerivedObjectOf<FGGroup,FPGroupRep>(newrep) { }
00248  
00249  
00250   ///////////////////////////////////////////////////////
00251   //                                                   //
00252   //  Debugging stuff                                  //
00253   //                                                   //
00254   ///////////////////////////////////////////////////////
00255  
00256 private:
00257  
00258 #ifdef DEBUG
00259 //  friend int main( );
00260 //  friend void debugPrint(ostream&, const FreeGroup& g);
00261 #endif
00262 
00263 };
00264 
00265 #endif
00266 

Generated at Tue Jun 19 09:49:36 2001 for Magnus Classes by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001