File: DecomposeInSubgroup.h

package info (click to toggle)
magnus 20060324-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 19,404 kB
  • ctags: 20,466
  • sloc: cpp: 130,118; ansic: 37,076; tcl: 10,970; perl: 1,109; makefile: 963; sh: 403; yacc: 372; csh: 57; awk: 33; asm: 10
file content (235 lines) | stat: -rw-r--r-- 6,089 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
// Copyright (C) 1998 The New York Group Theory Cooperative
// See magnus/doc/COPYRIGHT for the full notice.

// Contents: 
//
// Principal Author: Dmitry Pechkin
//
// Status: in progress
//
// Revision History:
//
// Bugs:
//
// Special Notes:
//
// Next implementation steps:
//


#ifndef _DECOMPOSE_IN_SUBGROUP_H_
#define _DECOMPOSE_IN_SUBGROUP_H_


#include "SubgroupGraph.h"
#include "FreeGroup.h"
#include "../AProducts/include/AP-fixups.h"

// NOTE: Original generators of subgroup should be freely reduced.

class DecomposeInSubgroupOfFreeGroup
{
public:
  
  DecomposeInSubgroupOfFreeGroup( const int ambientRank, 
				  const VectorOf<Word>& gens );
  // Construct a subgroup of a free group. `gens' are given generators
  // of the subgroup.

  virtual ~DecomposeInSubgroupOfFreeGroup( ) { }

  virtual DecomposeInSubgroupOfFreeGroup* clone( ) const {
    return new DecomposeInSubgroupOfFreeGroup( *this );
  }

  int rankOfFreeGroup( ) const { return theAmbientRank; }
  // Returns the rank of the ambient free group.

  VectorOf<Word> generators( ) const { return theGenerators; }
  // Returns the given generators of the subgroup.

  const SubgroupGraph& graph() const { return theGraph; }
  // Returns an graph represinting the subgroup.

  VectorOf<Word> decomposeNielsenBasis( ) const {
    return nielsenInSubgroupGenerators;
  }
  // Returns a decomposition of a Nielsen basis for the subgroup
  // in the original subgroup generators.

  bool contains( const Word& w ) const { return theGraph.contains(w); }
  // Checks whether the subgroup contains the given word.

  Word decompose( const Word& w ) const;
  // Express the word `w' in the given subgroup generators.

  Trichotomy checkDecomposition( const Word& w ) const;

  //protected:

  DecomposeInSubgroupOfFreeGroup( const SubgroupGraph& G, 
				  const VectorOf<Word>& gens );

  /////////////////////////////////////////////////////////////////////////
  //                                                                     //
  // IPC tools:                                                          //
  //                                                                     //
  /////////////////////////////////////////////////////////////////////////

  friend 
  ostream& operator<(ostream& ostr, const DecomposeInSubgroupOfFreeGroup& d) {
    d.write( ostr );
    return ostr;
  }

  friend 
  istream& operator>(istream& istr, DecomposeInSubgroupOfFreeGroup& d );

  virtual bool readPiece( istream& istr, const class Timer& timer );


private:
  
  void init( );

protected:



  VectorOf<Word> makeMapBetweenNielsens( SubgroupGraph& S, 
					 const VectorOf<Word>& words ) const;


  // Data members:

  int theAmbientRank;
  VectorOf<Word> theGenerators;

protected:
  SubgroupGraph theGraph;
  VectorOf<Word> nielsenInSubgroupGenerators;

  virtual void write( ostream& ostr ) const;
  int n;

private:

  enum ReadingState { STOP, GENS, GRAPH, NIELSEN };

  // Data members:
  ReadingState readState;
};




class DecomposeInExpandingSubgroup : public DecomposeInSubgroupOfFreeGroup
{
public:

  DecomposeInExpandingSubgroup( int ambientRank,
				const VectorOf<Word>& constantSubgroup, 
				const VectorOf<Word>& expandingSubgroup );
  // Construct expanding subgroup of free group. `expandingGens' will be 
  // conjugated by some elements to expand the subgroup.

  DecomposeInSubgroupOfFreeGroup* clone( ) const {
    return (DecomposeInSubgroupOfFreeGroup *)
              new DecomposeInExpandingSubgroup(*this);
  }

  VectorOf<Word> constantGenerators( ) const { return theConstantGenerators; }
  // Returns the original constant generators of the subgroup.

  VectorOf<Word> expandingGenerators( ) const { return theExpandingGenerators;}
  // Returns the original expanding generators of the subgroup.

  VectorOf<Generator> expandingConjugators( ) const {
    return theExpandingConjugators;
  }
  // Returns a list of conjugators which are used to expand the subgroup.
  // When we expand the subgroup by a conjugator this one is appened
  // to the end of the list.

  void expandSubgroupByConjugation( const Generator& conjugator );
  // Expand the subgroup by a conjugator.

  void expressAsConjugateOfOriginalGenerator( const Generator& g, 
					      Generator& og, Word& conjugator)
    const;
  // It computes an expression of the given generator `g' in an *expanded*
  // subgroup in original generator of the subgroup and conjugator of last one.

  ProductOfRelatorConjugates fullDecomposition( const Word& w ) const;

  Trichotomy checkDecomposition( const Word& w ) const;

  bool readPiece( istream& istr, const class Timer& timer );

private:

  VectorOf<Word> shiftGenerators( const VectorOf<Word>& v, int shift );


  // Data members:

  SubgroupGraph theConstantGraph;
  SubgroupGraph theExpandingGraph;

  VectorOf<Word> theConstantGenerators;
  VectorOf<Word> theExpandingGenerators;  

  // Data for expanding subgroup:
  int theNumberOfExpandedGenerators;
  VectorOf<Generator> theExpandingConjugators;
  VectorOf<Word> Nc, NcInOld, Ne0InOld;

protected:
  virtual void write( ostream& ostr ) const;


private:
  enum ReadingState2 { STOP, BASECLASS, CONSTGRAPH, EXPANDGRAPH, CONSTGENS, 
		       EXPANDGENS, READNC,READNCINOLD, READNE0INOLD };

  // Data members:
  ReadingState2 readState2;
};


class DecomposeInSubgroupOfFPGroup : public DecomposeInExpandingSubgroup
{
public:

  DecomposeInSubgroupOfFPGroup( const FPGroup& G, const VectorOf<Word>& gens );

  DecomposeInSubgroupOfFreeGroup* clone( ) const {
    return (DecomposeInSubgroupOfFreeGroup *)
              new DecomposeInSubgroupOfFPGroup(*this);
  }

  FPGroup group() const { return theGroup; }

  void expandGraph( );

  int numberOfIterations( ) const { return theNumberOfIterations; }

  bool readPiece( istream& istr, const class Timer& timer );

private:

  FPGroup theGroup;
  Generator g;
  int theNumberOfIterations;

protected:
  virtual void write( ostream& ostr ) const;

private:
  enum ReadingState3 { STOP, NEWDATA };

  // Data members:
  ReadingState3 readState3;
};

#endif