Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

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

236

237

238

239

240

241

242

243

244

245

246

247

248

249

250

251

252

253

254

255

256

257

258

259

260

261

262

263

264

265

266

267

268

269

270

271

272

273

274

275

276

277

278

279

280

281

282

283

284

285

286

287

288

289

290

291

292

293

294

295

296

297

298

299

300

301

302

303

304

305

306

307

308

309

310

311

312

313

314

315

316

317

318

319

320

321

322

323

324

325

326

327

328

329

330

331

332

333

334

335

336

337

338

339

340

341

342

343

344

345

346

347

348

349

350

351

352

353

354

355

356

357

358

359

360

361

362

363

364

365

366

367

368

369

370

371

372

373

374

375

376

377

378

379

380

381

382

383

384

385

386

387

388

389

390

391

392

393

394

395

396

397

398

399

400

401

402

403

404

405

406

407

408

409

r""" 

Groups of isometries. 

 

Let `M = \ZZ^n` or `\QQ^n`, `b: M \times M \rightarrow \QQ$ a bilinear form and 

$f: M \rightarrow M$ a linear map. We say that $f$ is an isometry if for all 

elements $x,y$ of $M$ we have that $b(x,y)=b(f(x),f(y))$. 

A group of isometries is a subgroup of $GL(M)$ consisting of isometries. 

 

EXAMPLES:: 

 

sage: L = IntegralLattice("D4") 

sage: O = L.orthogonal_group() 

sage: O 

Group of isometries with 5 generators ( 

[-1 0 0 0] [0 0 0 1] [-1 -1 -1 -1] [ 1 1 0 0] [ 1 0 0 0] 

[ 0 -1 0 0] [0 1 0 0] [ 0 0 1 0] [ 0 0 1 0] [-1 -1 -1 -1] 

[ 0 0 -1 0] [0 0 1 0] [ 0 1 0 1] [ 0 1 0 1] [ 0 0 1 0] 

[ 0 0 0 -1], [1 0 0 0], [ 0 -1 -1 0], [ 0 -1 -1 0], [ 0 0 0 1] 

) 

 

Basic functionality is provided by GAP:: 

 

sage: O.cardinality() 

1152 

sage: len(O.conjugacy_classes_representatives()) 

25 

 

AUTHORS: 

 

- Simon Brandhorst (2018-02): First created 

""" 

 

#***************************************************************************** 

# Copyright (C) 2018 Simon Brandhorst <sbrandhorst@web.de> 

# 

# This program is free software: you can redistribute it and/or modify 

# it under the terms of the GNU General Public License as published by 

# the Free Software Foundation, either version 2 of the License, or 

# (at your option) any later version. 

# http://www.gnu.org/licenses/ 

#***************************************************************************** 

from sage.misc.cachefunc import cached_method 

from sage.groups.matrix_gps.finitely_generated import FinitelyGeneratedMatrixGroup_gap 

from sage.categories.action import Action 

 

 

class GroupOfIsometries(FinitelyGeneratedMatrixGroup_gap): 

r""" 

A base class for Orthogonal matrix groups with a gap backend. 

 

Main difference to :class:`~sage.groups.matrix_gps.orthogonal.OrthogonalMatrixGroup_gap` is that we can 

specify generators and a bilinear form. Following gap the group action is from the right. 

 

INPUT: 

 

- ``degree`` -- integer, the degree (matrix size) of the matrix 

- ``base_ring`` -- ring, the base ring of the matrices 

- ``gens`` -- a list of matrices over the base ring 

- ``invariant_bilinear_form`` -- a symmetric matrix 

- ``category`` -- (default: ``None``) a category of groups 

- ``check`` -- bool (default: ``True``) check if the generators 

preserve the bilinear form 

- ``invariant_submodule`` -- a submodule preserved by the group action 

(default: ``None``) registers an action on this submodule. 

- ``invariant_quotient_module`` -- a quotient module preserved by 

the group action (default: ``None``) 

registers an action on this quotient module. 

 

EXAMPLES:: 

 

sage: from sage.groups.matrix_gps.isometries import GroupOfIsometries 

sage: bil = Matrix(ZZ,2,[3,2,2,3]) 

sage: gens = [-Matrix(ZZ,2,[0,1,1,0])] 

sage: O = GroupOfIsometries(2,ZZ,gens,bil) 

sage: O 

Group of isometries with 1 generator ( 

[ 0 -1] 

[-1 0] 

) 

sage: O.order() 

2 

 

Infinite groups are O.K. too:: 

 

sage: bil = Matrix(ZZ,4,[0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0]) 

sage: f = Matrix(ZZ,4,[0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, -1, 1, 1, 1]) 

sage: O = GroupOfIsometries(2,ZZ,[f],bil) 

sage: O.cardinality() 

+Infinity 

""" 

 

def __init__(self, degree, base_ring, 

gens, invariant_bilinear_form, 

category=None, check=True, 

invariant_submodule=None, 

invariant_quotient_module=None): 

r""" 

Create this orthogonal group from the input. 

 

TESTS:: 

 

sage: from sage.groups.matrix_gps.isometries import GroupOfIsometries 

sage: bil = Matrix(ZZ,2,[3,2,2,3]) 

sage: gens = [-Matrix(ZZ,2,[0,1,1,0])] 

sage: O = GroupOfIsometries(2,ZZ,gens,bil) 

sage: TestSuite(O).run() 

""" 

from copy import copy 

G = copy(invariant_bilinear_form) 

G.set_immutable() 

self._invariant_bilinear_form = G 

self._invariant_submodule = invariant_submodule 

self._invariant_quotient_module = invariant_quotient_module 

if check: 

I = invariant_submodule 

Q = invariant_quotient_module 

for f in gens: 

self._check_matrix(f) 

if (not I is None) and I*f != I: 

raise ValueError("the submodule is not preserved") 

if not Q is None and (Q.W() != Q.W()*f or Q.V()*f != Q.V()): 

raise ValueError("the quotient module is not preserved") 

if len(gens) == 0: # handle the trivial group 

gens = [G.parent().identity_matrix()] 

from sage.libs.gap.libgap import libgap 

gap_gens = [libgap(matrix_gen) for matrix_gen in gens] 

gap_group = libgap.Group(gap_gens) 

FinitelyGeneratedMatrixGroup_gap.__init__(self, 

degree, 

base_ring, 

gap_group, 

category=category) 

 

def _repr_(self): 

r""" 

Return the string representation of this matrix group. 

 

OUTPUT: 

 

- a string 

 

EXAMPLES:: 

 

sage: from sage.groups.matrix_gps.isometries import GroupOfIsometries 

sage: bil = Matrix(ZZ,2,[3,2,2,3]) 

sage: gens = [-Matrix(ZZ,2,[0,1,1,0])] 

sage: O = GroupOfIsometries(2,ZZ,gens,bil) 

sage: O 

Group of isometries with 1 generator ( 

[ 0 -1] 

[-1 0] 

) 

""" 

n = self.ngens() 

from sage.repl.display.util import format_list 

if n > 5: 

return 'Group of isometries with %s generators '%n 

elif n == 1: 

return 'Group of isometries with %s generator %s'%(n, format_list(self.gens())) 

else: 

return 'Group of isometries with %s generators %s'%(n, format_list(self.gens())) 

 

def invariant_bilinear_form(self): 

r""" 

Return the symmetric bilinear form preserved by the orthogonal group. 

 

OUTPUT: 

 

- the matrix defining the bilinear form 

 

EXAMPLES:: 

 

sage: from sage.groups.matrix_gps.isometries import GroupOfIsometries 

sage: bil = Matrix(ZZ,2,[3,2,2,3]) 

sage: gens = [-Matrix(ZZ,2,[0,1,1,0])] 

sage: O = GroupOfIsometries(2,ZZ,gens,bil) 

sage: O.invariant_bilinear_form() 

[3 2] 

[2 3] 

""" 

return self._invariant_bilinear_form 

 

def _get_action_(self, S, op, self_on_left): 

""" 

Provide the coercion system with an action. 

 

EXAMPLES:: 

 

sage: from sage.groups.matrix_gps.isometries import GroupOfIsometries 

sage: bil = Matrix(ZZ,2,[3,2,2,3]) 

sage: gens = [-Matrix(ZZ,2,[0,1,1,0])] 

sage: S = ZZ^2 

sage: T = S/(6*S) 

sage: O = GroupOfIsometries(2, ZZ, gens, bil, invariant_submodule=S, invariant_quotient_module=T) 

sage: O._get_action_(S, operator.mul, False) 

Right action by Group of isometries with 1 generator ( 

[ 0 -1] 

[-1 0] 

) on Ambient free module of rank 2 over the principal ideal domain Integer Ring 

sage: U = T.submodule([2*t for t in T.gens()]) 

sage: u = U.an_element() 

sage: f = O.an_element() 

sage: u*f 

(0, 2) 

""" 

import operator 

if op == operator.mul and not self_on_left: 

if S is self._invariant_submodule: 

return GroupActionOnSubmodule(self, S) 

if S is self._invariant_quotient_module: 

return GroupActionOnQuotientModule(self, S) 

from sage.modules.fg_pid.fgp_module import is_FGP_Module 

T = self._invariant_quotient_module 

if is_FGP_Module(S): 

if S.is_submodule(T): 

V = S.V() 

if all([V==V*f.matrix() for f in self.gens()]): 

return GroupActionOnQuotientModule(self, S) 

return None 

 

def _check_matrix(self, x, *args): 

r""" 

Check whether the matrix ``x`` preserves the bilinear form. 

 

See :meth:`~sage.groups.matrix_gps.matrix_group._check_matrix` 

for details. 

 

EXAMPLES:: 

 

sage: from sage.groups.matrix_gps.isometries import GroupOfIsometries 

sage: bil = Matrix(ZZ,2,[3,2,2,3]) 

sage: gens = [-Matrix(ZZ,2,[0,1,1,0])] 

sage: O = GroupOfIsometries(2,ZZ,gens,bil) 

sage: g = matrix.identity(2)*2 

sage: O(g) 

Traceback (most recent call last): 

... 

TypeError: matrix must be orthogonal with respect to the invariant form 

""" 

F = self.invariant_bilinear_form() 

if x * F * x.transpose() != F: 

raise TypeError('matrix must be orthogonal ' 

'with respect to the invariant form') 

 

class GroupActionOnSubmodule(Action): 

r""" 

Matrix group action on a submodule from the right. 

 

INPUT: 

 

- ``MatrixGroup`` -- an instance of :class:`GroupOfIsometries` 

- ``submodule`` -- an invariant submodule 

- ``is_left`` -- bool (default: ``False``) 

 

EXAMPLES:: 

 

sage: from sage.groups.matrix_gps.isometries import GroupOfIsometries 

sage: S = span(ZZ,[[0,1]]) 

sage: g = Matrix(QQ,2,[1,0,0,-1]) 

sage: G = GroupOfIsometries(2, ZZ, [g], invariant_bilinear_form=matrix.identity(2), invariant_submodule=S) 

sage: g = G.an_element() 

sage: x = S.an_element() 

sage: x*g 

(0, -1) 

sage: (x*g).parent() 

Free module of degree 2 and rank 1 over Integer Ring 

Echelon basis matrix: 

[0 1] 

""" 

def __init__(self, MatrixGroup,submodule, is_left=False): 

r""" 

Initialize the action 

 

TESTS:: 

 

sage: from sage.groups.matrix_gps.isometries import GroupOfIsometries, GroupActionOnSubmodule 

sage: S = span(ZZ,[[0,1]]) 

sage: g = Matrix(QQ,2,[1,0,0,-1]) 

sage: e = Matrix.identity(2) 

sage: G = GroupOfIsometries(2, ZZ, [g], e) 

sage: GroupActionOnSubmodule(G,S) 

Right action by Group of isometries with 1 generator ( 

[ 1 0] 

[ 0 -1] 

) on Free module of degree 2 and rank 1 over Integer Ring 

Echelon basis matrix: 

[0 1] 

""" 

import operator 

Action.__init__(self, MatrixGroup, submodule, is_left, operator.mul) 

 

def _call_(self, a, g): 

r""" 

This defines the group action. 

 

INPUT: 

 

- ``a`` -- an element of the invariant submodule 

- ``g`` -- an element of the acting group 

 

OUTPUT: 

 

- an element of the invariant submodule 

 

EXAMPLES:: 

 

sage: from sage.groups.matrix_gps.isometries import GroupActionOnSubmodule 

sage: S = span(QQ,[[0,1]]) 

sage: g = Matrix(QQ,2,[1,1,0,1/2]) 

sage: G = MatrixGroup([g]) 

sage: A = GroupActionOnSubmodule(G,S) 

sage: A 

Right action by Matrix group over Rational Field with 1 generators ( 

[ 1 1] 

[ 0 1/2] 

) on Vector space of degree 2 and dimension 1 over Rational Field 

Basis matrix: 

[0 1] 

sage: s = S.an_element() 

sage: g = G.an_element() 

sage: A(s,g).parent() 

Vector space of degree 2 and dimension 1 over Rational Field 

Basis matrix: 

[0 1] 

""" 

if self.is_left(): 

return a.parent()(g.matrix()*a) 

else: 

return a.parent()(a*g.matrix()) 

 

class GroupActionOnQuotientModule(Action): 

r""" 

Matrix group action on a quotient module from the right. 

 

INPUT: 

 

- ``MatrixGroup`` -- the group acting 

:class:`GroupOfIsometries` 

- ``submodule`` -- an invariant quotient module 

- ``is_left`` -- bool (default: ``False``) 

 

EXAMPLES:: 

 

sage: from sage.groups.matrix_gps.isometries import GroupOfIsometries 

sage: S = span(ZZ,[[0,1]]) 

sage: Q = S/(6*S) 

sage: g = Matrix(QQ,2,[1,0,0,-1]) 

sage: G = GroupOfIsometries(2, ZZ, [g], invariant_bilinear_form=matrix.identity(2), invariant_quotient_module=Q) 

sage: g = G.an_element() 

sage: x = Q.an_element() 

sage: x*g 

(5) 

sage: (x*g).parent() 

Finitely generated module V/W over Integer Ring with invariants (6) 

""" 

def __init__(self, MatrixGroup, quotient_module, is_left=False): 

r""" 

Initialize the action 

 

TESTS:: 

 

sage: from sage.groups.matrix_gps.isometries import GroupOfIsometries 

sage: S = span(ZZ,[[0,1]]) 

sage: Q = S/(6*S) 

sage: g = Matrix(QQ,2,[1,0,0,-1]) 

sage: G = GroupOfIsometries(2, ZZ, [g], invariant_bilinear_form=matrix.identity(2), invariant_quotient_module=Q) 

sage: g = G.an_element() 

sage: x = Q.an_element() 

sage: x, x*g 

((1), (5)) 

""" 

import operator 

Action.__init__(self, MatrixGroup, quotient_module, is_left, operator.mul) 

 

def _call_(self, a, g): 

r""" 

This defines the group action. 

 

INPUT: 

 

- ``a`` -- an element of the invariant submodule 

- ``g`` -- an element of the acting group 

 

OUTPUT: 

 

- an element of the invariant quotient module 

 

EXAMPLES:: 

 

sage: from sage.groups.matrix_gps.isometries import GroupActionOnQuotientModule 

sage: S = span(ZZ,[[0,1]]) 

sage: Q = S/(6*S) 

sage: g = Matrix(QQ,2,[1,1,0,7]) 

sage: G = MatrixGroup([g]) 

sage: A = GroupActionOnQuotientModule(G,Q) 

sage: A 

Right action by Matrix group over Rational Field with 1 generators ( 

[1 1] 

[0 7] 

) on Finitely generated module V/W over Integer Ring with invariants (6) 

sage: q = Q.an_element() 

sage: g = G.an_element() 

sage: A(q,g).parent() 

Finitely generated module V/W over Integer Ring with invariants (6) 

""" 

if self.is_left(): 

return a.parent()(g.matrix()*a.lift()) 

else: 

return a.parent()(a.lift()*g.matrix())