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

514

515

516

r""" 

Affine factorization crystal of type `A` 

""" 

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

# Copyright (C) 2014 Anne Schilling <anne at math.ucdavis.edu> 

# 

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

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

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

 

from sage.misc.lazy_attribute import lazy_attribute 

from sage.structure.parent import Parent 

from sage.structure.element_wrapper import ElementWrapper 

from sage.structure.unique_representation import UniqueRepresentation 

from sage.categories.classical_crystals import ClassicalCrystals 

from sage.categories.crystals import CrystalMorphism 

from sage.categories.enumerated_sets import EnumeratedSets 

from sage.categories.homset import Hom 

from sage.combinat.root_system.cartan_type import CartanType 

from sage.combinat.root_system.weyl_group import WeylGroup 

from sage.combinat.rsk import RSK 

 

class AffineFactorizationCrystal(UniqueRepresentation, Parent): 

r""" 

The crystal on affine factorizations with a cut-point, as introduced 

by [MS14]_. 

 

INPUT: 

 

- ``w`` -- an element in an (affine) Weyl group or a skew shape of `k`-bounded partitions (if `k` was specified) 

 

- ``n`` -- the number of factors in the factorization 

 

- ``x`` -- (default: ``None``) the cut point; if not specified it is determined as the minimal missing residue in ``w`` 

 

- ``k`` -- (default: ``None``) positive integer, specifies that ``w`` is `k`-bounded or a `k+1`-core when specified 

 

EXAMPLES:: 

 

sage: W = WeylGroup(['A',3,1], prefix='s') 

sage: w = W.from_reduced_word([2,3,2,1]) 

sage: B = crystals.AffineFactorization(w,3); B 

Crystal on affine factorizations of type A2 associated to s2*s3*s2*s1 

sage: B.list() 

[(1, s2, s3*s2*s1), 

(1, s3*s2, s3*s1), 

(1, s3*s2*s1, s3), 

(s3, s2, s3*s1), 

(s3, s2*s1, s3), 

(s3*s2, s1, s3), 

(s3*s2*s1, 1, s3), 

(s3*s2*s1, s3, 1), 

(s3*s2, 1, s3*s1), 

(s3*s2, s3, s1), 

(s3*s2, s3*s1, 1), 

(s2, 1, s3*s2*s1), 

(s2, s3, s2*s1), 

(s2, s3*s2, s1), 

(s2, s3*s2*s1, 1)] 

 

We can also access the crystal by specifying a skew shape in terms of `k`-bounded partitions:: 

 

sage: crystals.AffineFactorization([[3,1,1],[1]], 3, k=3) 

Crystal on affine factorizations of type A2 associated to s2*s3*s2*s1 

 

We can compute the highest weight elements:: 

 

sage: hw = [w for w in B if w.is_highest_weight()] 

sage: hw 

[(1, s2, s3*s2*s1)] 

sage: hw[0].weight() 

(3, 1, 0) 

 

And show that this crystal is isomorphic to the tableau model of the same weight:: 

 

sage: C = crystals.Tableaux(['A',2],shape=[3,1]) 

sage: GC = C.digraph() 

sage: GB = B.digraph() 

sage: GC.is_isomorphic(GB, edge_labels=True) 

True 

 

The crystal operators themselves move elements between adjacent factors:: 

 

sage: b = hw[0];b 

(1, s2, s3*s2*s1) 

sage: b.f(1) 

(1, s3*s2, s3*s1) 

 

The cut point `x` is not supposed to occur in the reduced words for `w`:: 

 

sage: B = crystals.AffineFactorization([[3,2],[2]],4,x=0,k=3) 

Traceback (most recent call last): 

... 

ValueError: x cannot be in reduced word of s0*s3*s2 

 

REFERENCES: 

 

.. [MS14] Jennifer Morse and Anne Schilling. 

*Crystal approach to affine Schubert calculus*. 

Int. Math. Res. Not. (2015). 

:doi:`10.1093/imrn/rnv194`, :arxiv:`1408.0320`. 

""" 

@staticmethod 

def __classcall_private__(cls, w, n, x = None, k = None): 

r""" 

Classcall to mend the input. 

 

TESTS:: 

 

sage: A = crystals.AffineFactorization([[3,1],[1]], 4, k=3); A 

Crystal on affine factorizations of type A3 associated to s3*s2*s1 

sage: AC = crystals.AffineFactorization([Core([4,1],4),Core([1],4)], 4, k=3) 

sage: AC is A 

True 

""" 

if k is not None: 

from sage.combinat.core import Core 

from sage.combinat.partition import Partition 

W = WeylGroup(['A',k,1], prefix='s') 

if isinstance(w[0], Core): 

w = [w[0].to_bounded_partition(), w[1].to_bounded_partition()] 

else: 

w = [Partition(w[0]), Partition(w[1])] 

w0 = W.from_reduced_word(w[0].from_kbounded_to_reduced_word(k)) 

w1 = W.from_reduced_word(w[1].from_kbounded_to_reduced_word(k)) 

w = w0*(w1.inverse()) 

return super(AffineFactorizationCrystal, cls).__classcall__(cls, w, n, x) 

 

def __init__(self, w, n, x = None): 

r""" 

EXAMPLES:: 

 

sage: B = crystals.AffineFactorization([[3,2],[2]],4,x=0,k=3) 

Traceback (most recent call last): 

... 

ValueError: x cannot be in reduced word of s0*s3*s2 

 

sage: B = crystals.AffineFactorization([[3,2],[2]],4,k=3) 

sage: B.x 

1 

sage: B.w 

s0*s3*s2 

sage: B.k 

3 

sage: B.n 

4 

 

TESTS:: 

 

sage: W = WeylGroup(['A',3,1], prefix='s') 

sage: w = W.from_reduced_word([2,3,2,1]) 

sage: B = crystals.AffineFactorization(w,3) 

sage: TestSuite(B).run() 

""" 

Parent.__init__(self, category = ClassicalCrystals()) 

self.n = n 

self.k = w.parent().n-1 

self.w = w 

cartan_type = CartanType(['A',n-1]) 

self._cartan_type = cartan_type 

from sage.combinat.sf.sf import SymmetricFunctions 

from sage.rings.all import QQ 

Sym = SymmetricFunctions(QQ) 

s = Sym.schur() 

support = s(w.stanley_symmetric_function()).support() 

support = [ [0]*(n-len(mu))+[mu[len(mu)-i-1] for i in range(len(mu))] for mu in support] 

generators = [tuple(p) for mu in support for p in affine_factorizations(w,n,mu)] 

#generators = [tuple(p) for p in affine_factorizations(w, n)] 

self.module_generators = [self(t) for t in generators] 

if x is None: 

if generators != []: 

x = min( set(range(self.k+1)).difference(set( 

sum([i.reduced_word() for i in generators[0]],[])))) 

else: 

x = 0 

if x in set(w.reduced_word()): 

raise ValueError("x cannot be in reduced word of {}".format(w)) 

self.x = x 

 

def _repr_(self): 

r""" 

EXAMPLES:: 

 

sage: W = WeylGroup(['A',3,1], prefix='s') 

sage: w = W.from_reduced_word([3,2,1]) 

sage: crystals.AffineFactorization(w,4) 

Crystal on affine factorizations of type A3 associated to s3*s2*s1 

 

sage: crystals.AffineFactorization([[3,1],[1]], 4, k=3) 

Crystal on affine factorizations of type A3 associated to s3*s2*s1 

""" 

return "Crystal on affine factorizations of type A{} associated to {}".format(self.n-1, self.w) 

 

# temporary workaround while an_element is overriden by Parent 

_an_element_ = EnumeratedSets.ParentMethods._an_element_ 

 

@lazy_attribute 

def _tableaux_isomorphism(self): 

""" 

Return the isomorphism from ``self`` to the tableaux model. 

 

EXAMPLES:: 

 

sage: W = WeylGroup(['A',3,1], prefix='s') 

sage: w = W.from_reduced_word([3,2,1]) 

sage: B = crystals.AffineFactorization(w,4) 

sage: B._tableaux_isomorphism 

['A', 3] Crystal morphism: 

From: Crystal on affine factorizations of type A3 associated to s3*s2*s1 

To: The crystal of tableaux of type ['A', 3] and shape(s) [[3]] 

 

sage: W = WeylGroup(['A',3,1], prefix='s') 

sage: w = W.from_reduced_word([2,1,3,2]) 

sage: B = crystals.AffineFactorization(w,3) 

sage: B._tableaux_isomorphism 

['A', 2] Crystal morphism: 

From: Crystal on affine factorizations of type A2 associated to s2*s3*s1*s2 

To: The crystal of tableaux of type ['A', 2] and shape(s) [[2, 2]] 

""" 

# Constructing the tableaux crystal 

from sage.combinat.crystals.tensor_product import CrystalOfTableaux 

def mg_to_shape(mg): 

l = list(mg.weight().to_vector()) 

while l and l[-1] == 0: 

l.pop() 

return l 

sh = [mg_to_shape(mg) for mg in self.highest_weight_vectors()] 

C = CrystalOfTableaux(self.cartan_type(), shapes=sh) 

phi = FactorizationToTableaux(Hom(self, C, category=self.category())) 

phi.register_as_coercion() 

return phi 

 

class Element(ElementWrapper): 

 

def e(self, i): 

r""" 

Return the action of `e_i` on ``self``. 

 

EXAMPLES:: 

 

sage: B = crystals.AffineFactorization([[3,1],[1]], 4, k=3) 

sage: W = B.w.parent() 

sage: t = B((W.one(),W.one(),W.from_reduced_word([3]),W.from_reduced_word([2,1]))); t 

(1, 1, s3, s2*s1) 

sage: t.e(1) 

(1, 1, 1, s3*s2*s1) 

""" 

if i not in self.index_set(): 

raise ValueError("i must be in the index set") 

b = self.bracketing(i) 

if not b[0]: 

return None 

W = self.parent().w.parent() 

x = self.parent().x 

k = self.parent().k 

n = self.parent().n 

a = min(b[0]) 

left = [j for j in (self.value[n-i-1]).reduced_word() if j != (a+x)%(k+1)] 

right = [(j-x)%(k+1) for j in (self.value[n-i]).reduced_word()] 

m = max([j for j in range(a) if (j+x)%(k+1) not in left]) 

right += [m+1] 

right.sort(reverse=True) 

right = [(j+x)%(k+1) for j in right] 

t = [self.value[j] for j in range(n-i-1)] + [W.from_reduced_word(left)] + [W.from_reduced_word(right)] + [self.value[j] for j in range(n-i+1,n)] 

return self.parent()(tuple(t)) 

 

def f(self, i): 

r""" 

Return the action of `f_i` on ``self``. 

 

EXAMPLES:: 

 

sage: B = crystals.AffineFactorization([[3,1],[1]], 4, k=3) 

sage: W = B.w.parent() 

sage: t = B((W.one(),W.one(),W.from_reduced_word([3]),W.from_reduced_word([2,1]))); t 

(1, 1, s3, s2*s1) 

sage: t.f(2) 

(1, s3, 1, s2*s1) 

sage: t.f(1) 

(1, 1, s3*s2, s1) 

""" 

if i not in self.index_set(): 

raise ValueError("i must be in the index set") 

b = self.bracketing(i) 

if not b[1]: 

return None 

W = self.parent().w.parent() 

x = self.parent().x 

k = self.parent().k 

n = self.parent().n 

a = max(b[1]) 

right = [j for j in (self.value[n-i]).reduced_word() if j != (a+x)%(k+1)] 

left = [(j-x)%(k+1) for j in (self.value[n-i-1]).reduced_word()] 

m = min([j for j in range(a+1,k+2) if (j+x)%(k+1) not in right]) 

left += [m-1] 

left.sort(reverse=True) 

left = [(j+x)%(k+1) for j in left] 

t = [self.value[j] for j in range(n-i-1)] + [W.from_reduced_word(left)] + [W.from_reduced_word(right)] + [self.value[j] for j in range(n-i+1,n)] 

return self.parent()(tuple(t)) 

 

def bracketing(self, i): 

r""" 

Removes all bracketed letters between `i`-th and `i+1`-th entry. 

 

EXAMPLES:: 

 

sage: B = crystals.AffineFactorization([[3,1],[1]], 3, k=3, x=4) 

sage: W = B.w.parent() 

sage: t = B((W.one(),W.from_reduced_word([3]),W.from_reduced_word([2,1]))); t 

(1, s3, s2*s1) 

sage: t.bracketing(1) 

[[3], [2, 1]] 

""" 

n = self.parent().n 

x = self.parent().x 

k = self.parent().k 

right = (self.value[n-i]).reduced_word() 

left = (self.value[n-i-1]).reduced_word() 

right_n = [(j-x)%(k+1) for j in right] 

left_n = [(j-x)%(k+1) for j in left] 

left_unbracketed = [] 

while left_n: 

m = max(left_n) 

left_n.remove(m) 

l = [j for j in right_n if j>m] 

if l: 

right_n.remove(min(l)) 

else: 

left_unbracketed += [m] 

return [[j for j in left_unbracketed],[j for j in right_n]] 

 

def to_tableau(self): 

""" 

Return the tableau representation of ``self``. 

 

Uses the recording tableau of a minor variation of 

Edelman-Greene insertion. See Theorem 4.11 in [MS14]_. 

 

EXAMPLES:: 

 

sage: W = WeylGroup(['A',3,1], prefix='s') 

sage: w = W.from_reduced_word([2,1,3,2]) 

sage: B = crystals.AffineFactorization(w,3) 

sage: for x in B: 

....: x 

....: x.to_tableau().pp() 

(1, s2*s1, s3*s2) 

1 1 

2 2 

(s2, s1, s3*s2) 

1 1 

2 3 

(s2, s3*s1, s2) 

1 2 

2 3 

(s2*s1, 1, s3*s2) 

1 1 

3 3 

(s2*s1, s3, s2) 

1 2 

3 3 

(s2*s1, s3*s2, 1) 

2 2 

3 3 

""" 

return self.parent()._tableaux_isomorphism(self) 

 

def affine_factorizations(w, l, weight=None): 

r""" 

Return all factorizations of ``w`` into ``l`` factors or of weight ``weight``. 

 

INPUT: 

 

- ``w`` -- an (affine) permutation or element of the (affine) Weyl group 

 

- ``l`` -- nonnegative integer 

 

- ``weight`` -- (default: None) tuple of nonnegative integers specifying the length of the factors 

 

EXAMPLES:: 

 

sage: W = WeylGroup(['A',3,1], prefix='s') 

sage: w = W.from_reduced_word([3,2,3,1,0,1]) 

sage: from sage.combinat.crystals.affine_factorization import affine_factorizations 

sage: affine_factorizations(w,4) 

[[s2, s3, s0, s2*s1*s0], 

[s2, s3, s2*s0, s1*s0], 

[s2, s3, s2*s1*s0, s1], 

[s2, s3*s2, s0, s1*s0], 

[s2, s3*s2, s1*s0, s1], 

[s2, s3*s2*s1, s0, s1], 

[s3*s2, s3, s0, s1*s0], 

[s3*s2, s3, s1*s0, s1], 

[s3*s2, s3*s1, s0, s1], 

[s3*s2*s1, s3, s0, s1]] 

 

sage: W = WeylGroup(['A',2], prefix='s') 

sage: w0 = W.long_element() 

sage: affine_factorizations(w0,3) 

[[1, s1, s2*s1], 

[1, s2*s1, s2], 

[s1, 1, s2*s1], 

[s1, s2, s1], 

[s1, s2*s1, 1], 

[s2, s1, s2], 

[s2*s1, 1, s2], 

[s2*s1, s2, 1]] 

sage: affine_factorizations(w0,3,(0,1,2)) 

[[1, s1, s2*s1]] 

sage: affine_factorizations(w0,3,(1,1,1)) 

[[s1, s2, s1], [s2, s1, s2]] 

sage: W = WeylGroup(['A',3], prefix='s') 

sage: w0 = W.long_element() 

sage: affine_factorizations(w0,6,(1,1,1,1,1,1)) 

[[s1, s2, s1, s3, s2, s1], 

[s1, s2, s3, s1, s2, s1], 

[s1, s2, s3, s2, s1, s2], 

[s1, s3, s2, s1, s3, s2], 

[s1, s3, s2, s3, s1, s2], 

[s2, s1, s2, s3, s2, s1], 

[s2, s1, s3, s2, s1, s3], 

[s2, s1, s3, s2, s3, s1], 

[s2, s3, s1, s2, s1, s3], 

[s2, s3, s1, s2, s3, s1], 

[s2, s3, s2, s1, s2, s3], 

[s3, s1, s2, s1, s3, s2], 

[s3, s1, s2, s3, s1, s2], 

[s3, s2, s1, s2, s3, s2], 

[s3, s2, s1, s3, s2, s3], 

[s3, s2, s3, s1, s2, s3]] 

sage: affine_factorizations(w0,6,(0,0,0,1,2,3)) 

[[1, 1, 1, s1, s2*s1, s3*s2*s1]] 

""" 

if weight is None: 

if l==0: 

if w.is_one(): 

return [[]] 

else: 

return [] 

else: 

return [[u]+p for (u,v) in w.left_pieri_factorizations() for p in affine_factorizations(v,l-1) ] 

else: 

if l != len(weight): 

return [] 

if l==0: 

if w.is_one(): 

return [[]] 

else: 

return [] 

else: 

return [[u]+p for (u,v) in w.left_pieri_factorizations(max_length=weight[0]) if u.length() == weight[0] 

for p in affine_factorizations(v,l-1,weight[1:]) ] 

 

##################################################################### 

## Crystal isomorphisms 

 

class FactorizationToTableaux(CrystalMorphism): 

def _call_(self, x): 

""" 

Return the image of ``x`` under ``self``. 

 

TESTS:: 

 

sage: W = WeylGroup(['A',3,1], prefix='s') 

sage: w = W.from_reduced_word([2,1,3,2]) 

sage: B = crystals.AffineFactorization(w,3) 

sage: phi = B._tableaux_isomorphism 

sage: [phi(b) for b in B] 

[[[1, 1], [2, 2]], 

[[1, 1], [2, 3]], 

[[1, 2], [2, 3]], 

[[1, 1], [3, 3]], 

[[1, 2], [3, 3]], 

[[2, 2], [3, 3]]] 

""" 

p = [] 

q = [] 

for i,factor in enumerate(reversed(x.value)): 

word = factor.reduced_word() 

p += [i+1]*len(word) 

# We sort for those pesky commutative elements 

# The word is most likely in reverse order to begin with 

q += sorted(reversed(word)) 

C = self.codomain() 

return C(RSK(p, q, insertion='EG')[1]) 

 

def is_isomorphism(self): 

""" 

Return ``True`` as this is an isomorphism. 

 

EXAMPLES:: 

 

sage: W = WeylGroup(['A',3,1], prefix='s') 

sage: w = W.from_reduced_word([2,1,3,2]) 

sage: B = crystals.AffineFactorization(w,3) 

sage: phi = B._tableaux_isomorphism 

sage: phi.is_isomorphism() 

True 

 

TESTS:: 

 

sage: W = WeylGroup(['A',4,1], prefix='s') 

sage: w = W.from_reduced_word([2,1,3,2,4,3,2,1]) 

sage: B = crystals.AffineFactorization(w, 4) 

sage: phi = B._tableaux_isomorphism 

sage: all(phi(b).e(i) == phi(b.e(i)) and phi(b).f(i) == phi(b.f(i)) 

....: for b in B for i in B.index_set()) 

True 

sage: set(phi(b) for b in B) == set(phi.codomain()) 

True 

""" 

return True 

 

is_embedding = is_isomorphism 

is_surjective = is_isomorphism