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

410

411

412

413

414

415

416

417

418

419

420

421

422

423

424

425

426

427

428

429

430

431

432

433

434

435

436

437

438

439

440

441

442

443

444

445

446

447

448

449

450

451

452

453

454

455

456

457

458

459

460

461

462

463

464

465

466

467

468

469

470

471

472

473

474

475

476

477

478

479

480

481

482

483

484

485

486

487

488

489

490

491

492

493

494

495

496

497

498

499

500

501

502

503

504

505

506

507

508

509

510

511

512

513

r""" 

Ambient lattices and ambient spaces 

""" 

from __future__ import absolute_import 

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

# Copyright (C) 2008-2009 Daniel Bump 

# Copyright (C) 2008-2013 Nicolas M. Thiery <nthiery at users.sf.net> 

# 

# Distributed under the terms of the GNU General Public License (GPL) 

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

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

from sage.misc.cachefunc import cached_method 

from sage.combinat.free_module import CombinatorialFreeModule 

from .weight_lattice_realizations import WeightLatticeRealizations 

from sage.rings.all import ZZ, QQ 

from sage.categories.homset import End 

 

import six 

 

 

class AmbientSpace(CombinatorialFreeModule): 

r""" 

Abstract class for ambient spaces 

 

All subclasses should implement a class method 

``smallest_base_ring`` taking a Cartan type as input, and a method 

``dimension`` working on a partially initialized instance with 

just ``root_system`` as attribute. There is no safe default 

implementation for the later, so none is provided. 

 

EXAMPLES:: 

 

sage: AL = RootSystem(['A',2]).ambient_lattice() 

 

.. NOTE:: This is only used so far for finite root systems. 

 

Caveat: Most of the ambient spaces currently have a basis indexed 

by `0,\dots, n`, unlike the usual mathematical convention:: 

 

sage: e = AL.basis() 

sage: e[0], e[1], e[2] 

((1, 0, 0), (0, 1, 0), (0, 0, 1)) 

 

This will be cleaned up! 

 

.. SEEALSO:: 

 

- :class:`sage.combinat.root_system.type_A.AmbientSpace` 

- :class:`sage.combinat.root_system.type_B.AmbientSpace` 

- :class:`sage.combinat.root_system.type_C.AmbientSpace` 

- :class:`sage.combinat.root_system.type_D.AmbientSpace` 

- :class:`sage.combinat.root_system.type_E.AmbientSpace` 

- :class:`sage.combinat.root_system.type_F.AmbientSpace` 

- :class:`sage.combinat.root_system.type_G.AmbientSpace` 

- :class:`sage.combinat.root_system.type_dual.AmbientSpace` 

- :class:`sage.combinat.root_system.type_affine.AmbientSpace` 

 

TESTS:: 

 

sage: types = CartanType.samples(crystallographic = True)+[CartanType(["A",2],["C",5])] 

sage: for e in [ct.root_system().ambient_space() for ct in types]: 

....: TestSuite(e).run() 

 

sage: e1 = RootSystem(['A',3]).ambient_lattice() 

sage: e2 = RootSystem(['B',3]).ambient_lattice() 

sage: e1 == e1 

True 

sage: e1 == e2 

False 

 

sage: e1 = RootSystem(['A',3]).ambient_space(QQ) 

sage: e2 = RootSystem(['A',3]).ambient_space(RR) 

sage: e1 == e2 

False 

""" 

def __init__(self, root_system, base_ring, index_set=None): 

""" 

EXAMPLES:: 

 

sage: e = RootSystem(['A',3]).ambient_lattice() 

sage: s = e.simple_reflections() 

 

sage: L = RootSystem(['A',3]).coroot_lattice() 

sage: e.has_coerce_map_from(L) 

True 

sage: e(L.simple_root(1)) 

(1, -1, 0, 0) 

""" 

self.root_system = root_system 

if index_set is None: 

index_set = tuple(range(0, self.dimension())) 

CombinatorialFreeModule.__init__(self, base_ring, 

index_set, 

prefix='e', 

category = WeightLatticeRealizations(base_ring)) 

coroot_lattice = self.root_system.coroot_lattice() 

coroot_lattice.module_morphism(self.simple_coroot, codomain=self).register_as_coercion() 

 

# FIXME: here for backward compatibility; 

# Should we use dimension everywhere? 

self.n = self.dimension() 

ct = root_system.cartan_type() 

if ct.is_irreducible() and ct.type() == 'E': 

self._v0 = self([0,0,0,0,0, 0,1, 1]) 

self._v1 = self([0,0,0,0,0,-2,1,-1]) 

 

 

def _test_norm_of_simple_roots(self, **options): 

""" 

Tests that the norm of the roots is, up to an overal constant factor, 

given by the symmetrizer of the Cartan matrix. 

 

.. SEEALSO:: :class:`TestSuite` 

 

EXAMPLES:: 

 

sage: e = RootSystem(['F',4]).ambient_space() 

sage: e._test_norm_of_simple_roots() 

""" 

tester = self._tester(**options) 

T = self.cartan_type() 

D = T.symmetrizer() 

alpha = self.simple_roots() 

for C in T.dynkin_diagram().connected_components(): 

tester.assertEqual(len( set( alpha[i].scalar(alpha[i]) / D[i] for i in C ) ), 1) 

 

# FIXME: attribute or method? 

def dimension(self): 

""" 

Return the dimension of this ambient space. 

 

EXAMPLES:: 

 

sage: from sage.combinat.root_system.ambient_space import AmbientSpace 

sage: e = RootSystem(['F',4]).ambient_space() 

sage: AmbientSpace.dimension(e) 

Traceback (most recent call last): 

... 

NotImplementedError 

 

""" 

raise NotImplementedError 

 

@classmethod 

def smallest_base_ring(cls, cartan_type=None): 

""" 

Return the smallest ground ring over which the ambient space can be realized. 

 

This class method will get called with the Cartan type as 

input. This default implementation returns `\QQ`; subclasses 

should override it as appropriate. 

 

EXAMPLES:: 

 

sage: e = RootSystem(['F',4]).ambient_space() 

sage: e.smallest_base_ring() 

Rational Field 

""" 

return QQ 

 

def _repr_(self): 

""" 

EXAMPLES:: 

 

sage: RootSystem(['A',4]).ambient_lattice() # indirect doctest 

Ambient lattice of the Root system of type ['A', 4] 

sage: RootSystem(['B',4]).ambient_space() 

Ambient space of the Root system of type ['B', 4] 

 

""" 

return self._name_string() 

 

def _name_string(self, capitalize=True, base_ring=False, type=True): 

""" 

EXAMPLES:: 

 

sage: RootSystem(['A',4]).ambient_lattice()._name_string() 

"Ambient lattice of the Root system of type ['A', 4]" 

 

""" 

return self._name_string_helper("ambient", capitalize=capitalize, base_ring=base_ring, type=type) 

 

def __call__(self, v): 

""" 

TESTS:: 

 

sage: R = RootSystem(['A',4]).ambient_lattice() 

sage: R([1,2,3,4,5]) 

(1, 2, 3, 4, 5) 

sage: len(R([1,0,0,0,0]).monomial_coefficients()) 

1 

""" 

# This adds coercion from a list 

if isinstance(v, (list, tuple)): 

K = self.base_ring() 

return self._from_dict(dict((i,K(c)) for i,c in enumerate(v) if c)) 

else: 

return CombinatorialFreeModule.__call__(self, v) 

 

 

def __getitem__(self,i): 

""" 

Note that indexing starts at 1. 

 

EXAMPLES:: 

 

sage: e = RootSystem(['A',2]).ambient_lattice() 

sage: e[1] 

(1, 0, 0) 

sage: e[0] 

Traceback (most recent call last): 

... 

IndexError: value out of range 

""" 

if not (i > 0 and i <= self.dimension()): 

raise IndexError("value out of range") 

return self.monomial(i-1) 

 

def coroot_lattice(self): 

""" 

EXAMPLES:: 

 

sage: e = RootSystem(["A", 3]).ambient_lattice() 

sage: e.coroot_lattice() 

Ambient lattice of the Root system of type ['A', 3] 

""" 

return self 

 

def simple_coroot(self, i): 

r""" 

Returns the i-th simple coroot, as an element of this space 

 

EXAMPLES:: 

 

sage: R = RootSystem(["A",3]) 

sage: L = R.ambient_lattice() 

sage: L.simple_coroot(1) 

(1, -1, 0, 0) 

sage: L.simple_coroot(2) 

(0, 1, -1, 0) 

sage: L.simple_coroot(3) 

(0, 0, 1, -1) 

""" 

return self.simple_root(i).associated_coroot() 

 

def reflection(self, root, coroot=None): 

""" 

EXAMPLES:: 

 

sage: e = RootSystem(["A", 3]).ambient_lattice() 

sage: a = e.simple_root(0); a 

(-1, 0, 0, 0) 

sage: b = e.simple_root(1); b 

(1, -1, 0, 0) 

sage: s_a = e.reflection(a) 

sage: s_a(b) 

(0, -1, 0, 0) 

 

""" 

# TODO: get rid of this as one can use the generic implementation 

# (i.e. scalar and associated coroot are implemented) 

return lambda v: v - root.base_ring()(2*root.inner_product(v)/root.inner_product(root))*root 

 

@cached_method 

def fundamental_weight(self, i): 

""" 

Returns the fundamental weight `\Lambda_i` in ``self`` 

 

In several of the ambient spaces, it is more convenient to 

construct all fundamental weights at once. To support this, we 

provide this default implementation of ``fundamental_weight`` 

using the method ``fundamental_weights``. Beware that this 

will cause a loop if neither ``fundamental_weight`` nor 

``fundamental_weights`` is implemented. 

 

EXAMPLES:: 

 

sage: e = RootSystem(['F',4]).ambient_space() 

sage: e.fundamental_weight(3) 

(3/2, 1/2, 1/2, 1/2) 

 

sage: e = RootSystem(['G',2]).ambient_space() 

sage: e.fundamental_weight(1) 

(1, 0, -1) 

 

sage: e = RootSystem(['E',6]).ambient_space() 

sage: e.fundamental_weight(3) 

(-1/2, 1/2, 1/2, 1/2, 1/2, -5/6, -5/6, 5/6) 

""" 

return self.fundamental_weights()[i] 

 

def from_vector_notation(self, weight, style="lattice"): 

""" 

INPUT: 

 

- ``weight`` - a vector or tuple representing a weight 

 

Returns an element of self. If the weight lattice is not 

of full rank, it coerces it into the weight lattice, or 

its ambient space by orthogonal projection. This arises 

in two cases: for SL(r+1), the weight lattice is 

contained in a hyperplane of codimension one in the ambient, 

space, and for types E6 and E7, the weight lattice is 

contained in a subspace of codimensions 2 or 3, respectively. 

 

If style="coroots" and the data is a tuple of integers, it 

is assumed that the data represent a linear combination of 

fundamental weights. If style="coroots", and the root lattice 

is not of full rank in the ambient space, it is projected 

into the subspace corresponding to the semisimple derived group. 

This arises with Cartan type A, E6 and E7. 

 

EXAMPLES:: 

 

sage: RootSystem("A2").ambient_space().from_vector_notation((1,0,0)) 

(1, 0, 0) 

sage: RootSystem("A2").ambient_space().from_vector_notation([1,0,0]) 

(1, 0, 0) 

sage: RootSystem("A2").ambient_space().from_vector_notation((1,0),style="coroots") 

(2/3, -1/3, -1/3) 

""" 

if style == "coroots" and isinstance(weight, tuple) and all(xv in ZZ for xv in weight): 

weight = self.linear_combination(zip(self.fundamental_weights(), weight)) 

 

x = self(weight) 

 

if style == "coroots": 

cartan_type = self.cartan_type() 

if cartan_type.is_irreducible() and cartan_type.type() == 'E': 

if cartan_type.rank() == 6: 

x = x.coerce_to_e6() 

if cartan_type.rank() == 7: 

x = x.coerce_to_e7() 

else: 

x = x.coerce_to_sl() 

return x 

 

def to_ambient_space_morphism(self): 

r""" 

Return the identity map on ``self``. 

 

This is present for uniformity of use; the corresponding method 

for abstract root and weight lattices/spaces, is not trivial. 

 

EXAMPLES:: 

 

sage: P = RootSystem(['A',2]).ambient_space() 

sage: f = P.to_ambient_space_morphism() 

sage: p = P.an_element() 

sage: p 

(2, 2, 3) 

sage: f(p) 

(2, 2, 3) 

sage: f(p)==p 

True 

""" 

return End(self).identity() 

 

class AmbientSpaceElement(CombinatorialFreeModule.Element): 

# For backward compatibility 

def _repr_(self): 

""" 

EXAMPLES:: 

 

sage: e = RootSystem(['A',2]).ambient_space() 

sage: e.simple_root(0) # indirect doctest 

(-1, 0, 0) 

""" 

return str(self.to_vector()) 

 

def inner_product(self, lambdacheck): 

""" 

The scalar product with elements of the coroot lattice 

embedded in the ambient space. 

 

EXAMPLES:: 

 

sage: e = RootSystem(['A',2]).ambient_space() 

sage: a = e.simple_root(0); a 

(-1, 0, 0) 

sage: a.inner_product(a) 

2 

""" 

self_mc = self._monomial_coefficients 

lambdacheck_mc = lambdacheck._monomial_coefficients 

 

result = self.parent().base_ring().zero() 

for t,c in six.iteritems(lambdacheck_mc): 

if t not in self_mc: 

continue 

result += c*self_mc[t] 

return result 

 

scalar = inner_product 

dot_product = inner_product 

 

def associated_coroot(self): 

""" 

EXAMPLES:: 

 

sage: e = RootSystem(['F',4]).ambient_space() 

sage: a = e.simple_root(0); a 

(1/2, -1/2, -1/2, -1/2) 

sage: a.associated_coroot() 

(1, -1, -1, -1) 

 

""" 

# FIXME: make it work over ZZ! 

return self * self.base_ring()(2/self.inner_product(self)) 

 

def is_positive_root(self): 

""" 

EXAMPLES:: 

 

sage: R = RootSystem(['A',3]).ambient_space() 

sage: r=R.simple_root(1)+R.simple_root(2) 

sage: r.is_positive_root() 

True 

sage: r=R.simple_root(1)-R.simple_root(2) 

sage: r.is_positive_root() 

False 

""" 

return self.parent().rho().scalar(self) > 0 

 

def coerce_to_sl(self): 

""" 

For type ['A',r], this coerces the element of the ambient space into the 

root space by orthogonal projection. The root space has codimension one 

and corresponds to the Lie algebra of SL(r+1,CC), whereas the full weight 

space corresponds to the Lie algebra of GL(r+1,CC). So this operation 

corresponds to multiplication by a (possibly fractional) power of the 

determinant to give a weight determinant one. 

 

EXAMPLES:: 

 

sage: [fw.coerce_to_sl() for fw in RootSystem("A2").ambient_space().fundamental_weights()] 

[(2/3, -1/3, -1/3), (1/3, 1/3, -2/3)] 

sage: L = RootSystem("A2xA3").ambient_space() 

sage: L([1,2,3,4,5,0,0]).coerce_to_sl() 

(-1, 0, 1, 7/4, 11/4, -9/4, -9/4) 

""" 

cartan_type = self.parent().cartan_type() 

x = self 

if cartan_type.is_atomic(): 

if cartan_type.type() == 'A': 

x = x - self.parent().det(sum(x.to_vector())/(self.parent().dimension())) 

else: 

xv = x.to_vector() 

shifts = cartan_type._shifts 

types = cartan_type.component_types() 

for i in range(len(types)): 

if cartan_type.component_types()[i][0] == 'A': 

s = self.parent().ambient_spaces()[i].det(sum(xv[shifts[i]:shifts[i+1]])/(types[i][1]+1)) 

x = x - self.parent().inject_weights(i, s) 

return x 

 

def coerce_to_e7(self): 

""" 

For type E8, this orthogonally projects the given element of 

the E8 root lattice into the E7 root lattice. This operation on 

weights corresponds to intersection with the semisimple subgroup E7. 

 

EXAMPLES:: 

 

sage: [b.coerce_to_e7() for b in RootSystem("E8").ambient_space().basis()] 

[(1, 0, 0, 0, 0, 0, 0, 0), (0, 1, 0, 0, 0, 0, 0, 0), 

(0, 0, 1, 0, 0, 0, 0, 0), (0, 0, 0, 1, 0, 0, 0, 0), 

(0, 0, 0, 0, 1, 0, 0, 0), (0, 0, 0, 0, 0, 1, 0, 0), 

(0, 0, 0, 0, 0, 0, 1/2, -1/2), (0, 0, 0, 0, 0, 0, -1/2, 1/2)] 

""" 

x = self 

v0 = self.parent()._v0 

ret = x - (x.inner_product(v0)/2)*v0 

return ret 

 

def coerce_to_e6(self): 

""" 

For type E7 or E8, orthogonally projects an element of the root lattice 

into the E6 root lattice. This operation on weights corresponds to 

intersection with the semisimple subgroup E6. 

 

EXAMPLES:: 

 

sage: [b.coerce_to_e6() for b in RootSystem("E8").ambient_space().basis()] 

[(1, 0, 0, 0, 0, 0, 0, 0), (0, 1, 0, 0, 0, 0, 0, 0), (0, 0, 1, 0, 0, 0, 0, 0), 

(0, 0, 0, 1, 0, 0, 0, 0), (0, 0, 0, 0, 1, 0, 0, 0), (0, 0, 0, 0, 0, 1/3, 1/3, -1/3), 

(0, 0, 0, 0, 0, 1/3, 1/3, -1/3), (0, 0, 0, 0, 0, -1/3, -1/3, 1/3)] 

""" 

x = self 

v0 = self.parent()._v0 

v1 = self.parent()._v1 

x = x - (x.inner_product(v0)/2)*v0 

return x - (x.inner_product(v1)/6)*v1 

 

def to_ambient(self): 

r""" 

Map ``self`` to the ambient space. 

 

This exists for uniformity. Its analogue for root and weight lattice realizations, 

is not trivial. 

 

EXAMPLES:: 

 

sage: v = CartanType(['C',3]).root_system().ambient_space().an_element(); v 

(2, 2, 3) 

sage: v.to_ambient() 

(2, 2, 3) 

 

""" 

return self 

 

AmbientSpace.Element = AmbientSpaceElement