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

/magnus/back_end/AProducts/include/OneRelatorGroup.h

Go to the documentation of this file.
00001 /*
00002  *   $Id: OneRelatorGroup.h,v 1.4 1998/03/07 23:01:17 alex Exp $
00003  */
00004 
00005 // Copyright (C) 1996 The New York Group Theory Cooperative
00006 // See magnus/doc/COPYRIGHT for the full notice.
00007 
00008 // Contents:
00009 //
00010 // Principal Author:
00011 //
00012 // Status:
00013 //
00014 // Revision History:
00015 //
00016 
00017 #ifndef _ONE_RELATOR_GROUP_H_
00018 #define _ONE_RELATOR_GROUP_H_
00019 
00020 #include "Word.h"
00021 #include "Chars.h"
00022 #include "Vector.h"
00023 #include "FPGroup.h"
00024 #include "AP-fixups.h"
00025 
00026 class OneRelatorGroupRep : public FGGroupRep
00027 {
00028 
00029 public:
00030 
00031   ///////////////////////////////////////////////////////
00032   //                                                   //
00033   //  Constructors                                     //
00034   //                                                   //
00035   ///////////////////////////////////////////////////////
00036         
00037   OneRelatorGroupRep( int ngens, const Word& relator );
00038   // To construct a group of given number of unnamed generators and
00039   // a given relator.
00040   
00041   OneRelatorGroupRep( const VectorOf<Chars>& gennames, const Word& relator ); 
00042   // To construct a group with named generators, a given relator.  
00043 
00044   OneRelatorGroupRep( const FPGroup& G );
00045   
00046   // Copy ctor, operator= and dtor provided by compiler.
00047 
00048   /////////////////////////////////////////////////////////////////////////
00049   //                                                                     //
00050   // Representation methods:                                             //
00051   //                                                                     //
00052   /////////////////////////////////////////////////////////////////////////
00053   
00054   PureRep* clone( ) const { return new OneRelatorGroupRep(*this); }
00055   // Overrides FGGroupRep::clone().
00056 
00057   static const Type theOneRelatorGroupType;
00058 
00059   static Type type( ) { return theOneRelatorGroupType; }
00060   // dominates FGGroupRep::type()
00061 
00062   Type actualType( ) const { return type(); }
00063   // overrides FGGroupRep::actualType();
00064 
00065   ///////////////////////////////////////////////////////
00066   //                                                   //
00067   //  Accessors / Modifiers                            //
00068   //                                                   //
00069   ///////////////////////////////////////////////////////
00070 
00071   //FPGroup presentation( ) const { return theFPGroup; }
00072 
00073   // Word relator( ) const { return theRelator; }
00074 
00075   //  int numberOfGenerators( ) const { return theFPGroup.numberOfGenerators(); }
00076 
00077   // VectorOf<Chars> namesOfGenerators() const { return theFPGroup.namesOfGenerators(); }
00078 
00079   ///////////////////////////////////////////////////////
00080   //                                                   //
00081   //  Methods dealing with group structure             //
00082   //                                                   //
00083   ///////////////////////////////////////////////////////
00084 
00085   int order( ) const;
00086 
00087   Trichotomy isTrivial( ) const; 
00088   // override FGGroupRep::isTrivial().
00089 
00090   Trichotomy isFinite( ) const; 
00091   // override FGGroupRep::isFinite().
00092 
00093   Trichotomy isInfinite( ) const;
00094   // override FGGroupRep::isInfinite().
00095 
00096   Trichotomy isAbelian( ) const; 
00097   // override FGGroupRep::isAbelian().
00098 
00099   Trichotomy isFree( ) const;
00100   // override FGGroupRep::isFree().
00101 
00102   ///////////////////////////////////////////////////////
00103   //                                                   //
00104   //  Methods which deal with group elements           //
00105   //                                                   //
00106   ///////////////////////////////////////////////////////
00107 
00108   Trichotomy wordProblem( const Word& w, bool keepDetails,
00109     ProductOfRelatorConjugates& productOfRelatorConjugates ) const;
00110 
00111   Trichotomy wordProblem( const Word& w ) const;
00112 
00113   Trichotomy areEqual( const Elt& e1, const Elt& e2 ) const {
00114     return wordProblem( e1 * e2.inverse() );
00115   }
00116 
00117   Elt eval( const Word& w ) const { return w.freelyReduce(); }
00118   // Overrides pure-virtual FGGroupRep::eval().
00119 
00120   Trichotomy conjugacyProblem( const Word& u, const Word& w ) const {
00121     return dontknow;
00122   }
00123   // Overrides pure-virtual FGGroupRep::eval().
00124   // This method is required by compiler to instantiate this class.
00125   // This problem is unsolvable in theory.
00126   
00127 
00128   ///////////////////////////////////////////////////////
00129   //                                                   //
00130   //  I/O                                              //
00131   //                                                   //
00132   ///////////////////////////////////////////////////////
00133 
00134   GroupRep* readFrom( istream& istr, Chars& errMesg ) const;
00135 
00136   void printOn( ostream& ostr ) const;
00137 
00138   bool operator == ( const OneRelatorGroupRep& G ) const {
00139     if( theNumberOfGenerators == G.theNumberOfGenerators 
00140         && theRelator == G.theRelator )
00141       return true;
00142     return false;
00143   }
00144 
00145   bool operator != ( const OneRelatorGroupRep& G ) const {
00146     return !( *this == G );
00147   }
00148 
00149   ///////////////////////////////////////////////////////
00150   //                                                   //
00151   //  IPC tools:                                       //
00152   //                                                   //
00153   ///////////////////////////////////////////////////////
00154 
00155   void write( ostream& ostr ) const;
00156   // overrides FGGroupRep::write().
00157 
00158   void read( istream& istr );
00159   // overrides FGGroupRep::read().
00160 
00161  
00162   ///////////////////////////////////////////////////////
00163   //                                                   //
00164   //  Data:                                            //
00165   //                                                   //
00166   ///////////////////////////////////////////////////////
00167 
00168   Word theRelator;  
00169 };
00170 
00171 
00172 
00173 class OneRelatorGroup 
00174   : public DerivedObjectOf< FGGroup, OneRelatorGroupRep >
00175 {
00176 
00177 public:
00178 
00179   /////////////////////////////////////////////////////////////////////////
00180   //                                                                     //
00181   //  Constructors:                                                      //
00182   //                                                                     //
00183   /////////////////////////////////////////////////////////////////////////
00184 
00185   OneRelatorGroup( int ngens, const Word& relator ) 
00186     : DerivedObjectOf<FGGroup, OneRelatorGroupRep>( 
00187         new OneRelatorGroupRep( ngens, relator ) ) {} 
00188   // To construct a group of given number of unnamed generators and
00189   // a given relator.
00190   
00191   OneRelatorGroup( const VectorOf<Chars>& gennames, const Word& relator )
00192     : DerivedObjectOf<FGGroup, OneRelatorGroupRep>( 
00193         new OneRelatorGroupRep( gennames, relator ) ) {} 
00194   // To construct a group with named generators, a given relator.  
00195 
00196   OneRelatorGroup( const FPGroup& G )
00197     : DerivedObjectOf<FGGroup, OneRelatorGroupRep>( 
00198         new OneRelatorGroupRep( G ) ) {} 
00199   
00200   // Copy constructor, operator=, and destructor supplied by compiler.
00201 
00202   /////////////////////////////////////////////////////////////////////////
00203   //                                                                     //
00204   //  Accessors:                                                         //
00205   //                                                                     //
00206   /////////////////////////////////////////////////////////////////////////
00207 
00208   Word relator( ) const { return look()->theRelator; }
00209 
00210   /////////////////////////////////////////////////////////////////////////
00211   //                                                                     //
00212   //  Methods and operators which deal with the group:                   //
00213   //                                                                     //
00214   /////////////////////////////////////////////////////////////////////////
00215   
00216   /////////////////////////////////////////////////////////////////////////
00217   //                                                                     //
00218   //  Methods and operators which deal with subgroups:                   //
00219   //                                                                     //
00220   /////////////////////////////////////////////////////////////////////////
00221 
00222   /////////////////////////////////////////////////////////////////////////
00223   //                                                                     //
00224   //  Methods which deal with group elements:                            //
00225   //                                                                     //
00226   /////////////////////////////////////////////////////////////////////////
00227 
00228   Trichotomy wordProblem( const Word& w ) const
00229   {
00230     ProductOfRelatorConjugates dummy;
00231     const bool dontKeepDetails = false;
00232     return look()->wordProblem( w, dontKeepDetails, dummy );
00233   }
00234 
00235 
00236   Trichotomy wordProblem( const Word& w, bool keepDetails, 
00237     ProductOfRelatorConjugates& productOfRelatorConjugates ) const
00238   {
00239     return look()->wordProblem( w, keepDetails, productOfRelatorConjugates );
00240   }
00241 
00242   // Trichotomy wordProblem( const Word& w ) const;
00243   // Overrides pseudo-virtual FGGroup::wordProblem().
00244 
00245   /////////////////////////////////////////////////////////////////////////
00246   //                                                                     //
00247   // I/O:                                                                //
00248   //                                                                     //
00249   /////////////////////////////////////////////////////////////////////////
00250 
00251   /////////////////////////////////////////////////////////////////////////
00252   //                                                                     //
00253   // IPC tools:                                                          //
00254   //                                                                     //
00255   /////////////////////////////////////////////////////////////////////////
00256 
00257   friend ostream& operator < ( ostream& ostr, const OneRelatorGroup& G )
00258   {
00259     G.look()->write(ostr);
00260     return ostr;
00261   }
00262   
00263   friend istream& operator > ( istream& istr, OneRelatorGroup& G )
00264   {
00265     G.change()->read(istr);
00266     return istr;
00267   }
00268 
00269 protected:
00270 
00271   /////////////////////////////////////////////////////////////////////////
00272   //                                                                     //
00273   // Protected functions:                                                //
00274   //                                                                     //
00275   /////////////////////////////////////////////////////////////////////////
00276 
00277   OneRelatorGroup( OneRelatorGroupRep *newrep ) 
00278     : DerivedObjectOf<FGGroup, OneRelatorGroupRep> ( newrep ) { }
00279 
00280 };
00281 
00282 
00283 /////////////////////////////////////////////////////////////////////////// 
00284 
00285 class EnumeratorOfConsequences 
00286 {
00287 public:
00288   EnumeratorOfConsequences( const OneRelatorGroup& G );
00289   // Create enumerator of all relator's consequences for the given group.
00290 
00291   Word word() const;
00292   // It returns a consequence of the relator.
00293 
00294   ProductOfRelatorConjugates tuple() const;
00295   // It return a consequence is presented as decomposition of conjugates
00296   // of the given relator.
00297 
00298   void reset();
00299   // Resets the enumerator.
00300 
00301   bool done() const;
00302   // Returns false iff all consequences are enumerated.
00303 
00304   void advance();
00305   // It advances enumeration.
00306  
00307   /////////////////////////////////////////////////////////////////////////
00308   //                                                                     //
00309   // IPC tools:                                                          //
00310   //                                                                     //
00311   /////////////////////////////////////////////////////////////////////////
00312 
00313   friend ostream& operator < ( ostream& ostr, const EnumeratorOfConsequences& ce )
00314   {
00315     ostr 
00316       < ce.theCurrentWordNumber 
00317       < ce.theLastComputedWordNumber
00318       < ce.theCurrentWord
00319       < ce.theCurrentProduct
00320       < ce.theRelator
00321       < ce.theGroup;
00322       
00323     return ostr;
00324   }
00325   
00326   friend istream& operator > ( istream& istr, EnumeratorOfConsequences& ce )
00327   {
00328     
00329     istr 
00330       > ce.theCurrentWordNumber 
00331       > ce.theLastComputedWordNumber
00332       > ce.theCurrentWord
00333       > ce.theCurrentProduct
00334       > ce.theRelator
00335       > ce.theGroup;
00336   
00337   return istr;
00338   }
00339 
00340 private:
00341 
00342   void generate( ) const;
00343   // Generate new consequence.
00344 
00345   Integer theCurrentWordNumber;
00346   Integer theLastComputedWordNumber;
00347   Word theCurrentWord;
00348   ProductOfRelatorConjugates theCurrentProduct;
00349   Word theRelator;
00350   FreeGroup theGroup;
00351 };
00352 
00353 #endif

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