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

517

518

519

520

521

522

523

524

525

526

527

528

529

530

531

532

533

534

535

536

537

538

539

540

541

542

543

544

545

546

547

548

549

550

551

552

553

554

555

556

557

558

559

560

561

562

563

564

565

566

567

568

569

570

571

572

573

574

575

576

577

578

579

580

581

582

583

584

585

586

587

588

589

590

591

592

593

594

595

596

597

598

599

600

601

602

603

604

605

606

607

608

609

610

611

612

613

614

615

616

617

618

619

620

621

622

623

624

625

626

627

628

629

630

631

632

633

634

635

636

637

638

639

640

641

642

643

644

645

646

647

648

649

650

651

652

653

654

655

656

657

658

659

660

661

662

663

664

665

666

667

668

669

670

671

672

673

674

675

676

677

678

679

680

681

682

683

684

685

686

687

688

689

690

691

692

693

694

695

696

697

698

699

700

701

702

703

704

705

706

707

708

709

710

711

712

713

714

715

716

717

718

719

720

721

722

723

724

725

726

727

728

729

730

731

732

733

734

735

736

737

738

739

740

741

742

743

744

745

746

747

748

749

750

751

752

753

754

755

756

757

758

759

760

761

762

763

764

765

766

767

768

769

770

771

772

773

774

775

776

777

778

779

780

781

782

783

784

785

786

787

788

789

790

791

792

793

794

795

796

797

798

799

800

801

802

803

804

805

806

807

808

809

810

811

812

813

814

815

816

817

818

819

820

821

822

823

824

825

826

827

828

829

830

831

832

833

834

835

836

837

838

839

840

841

842

843

844

845

846

847

848

849

850

851

852

853

854

855

856

857

858

859

860

861

862

863

864

865

866

867

868

869

870

871

872

873

874

875

876

877

878

879

880

881

882

883

884

885

886

887

888

889

890

891

892

893

894

895

896

897

898

899

900

901

902

903

904

905

906

907

908

909

910

911

912

913

914

915

916

917

918

919

920

921

922

923

924

925

926

927

928

929

930

931

932

933

934

935

936

937

938

939

940

941

942

943

944

945

946

947

948

949

950

951

952

953

954

955

956

957

958

959

960

961

962

963

964

965

966

967

968

969

970

971

972

973

974

975

976

977

978

979

980

981

982

983

984

985

986

987

988

989

990

991

992

993

994

995

996

997

998

999

1000

1001

1002

1003

1004

1005

1006

1007

1008

1009

1010

1011

1012

1013

1014

1015

1016

1017

1018

1019

1020

1021

1022

1023

1024

1025

1026

1027

1028

1029

1030

1031

1032

1033

1034

1035

1036

1037

1038

1039

1040

1041

1042

1043

1044

1045

1046

1047

1048

1049

1050

1051

1052

1053

1054

1055

1056

1057

1058

1059

1060

1061

1062

1063

1064

1065

1066

1067

1068

1069

1070

1071

1072

1073

1074

1075

1076

1077

1078

1079

1080

1081

1082

1083

1084

1085

1086

1087

1088

1089

1090

1091

1092

1093

1094

1095

1096

1097

1098

1099

1100

1101

1102

1103

1104

1105

1106

1107

1108

1109

1110

1111

1112

1113

1114

1115

1116

1117

1118

1119

1120

1121

1122

1123

1124

1125

1126

1127

1128

1129

1130

1131

1132

1133

1134

1135

1136

1137

1138

1139

1140

1141

1142

1143

1144

1145

1146

1147

1148

1149

1150

1151

1152

1153

1154

1155

1156

1157

1158

1159

1160

1161

1162

1163

1164

1165

1166

1167

1168

1169

1170

1171

1172

1173

1174

1175

1176

1177

1178

1179

1180

1181

1182

1183

1184

1185

1186

1187

1188

1189

1190

1191

1192

1193

1194

1195

1196

1197

1198

1199

1200

1201

1202

1203

1204

1205

1206

1207

1208

1209

1210

1211

1212

1213

1214

1215

1216

1217

1218

1219

1220

1221

1222

1223

1224

1225

1226

1227

1228

1229

1230

1231

1232

1233

1234

1235

1236

1237

1238

1239

1240

1241

1242

1243

1244

1245

1246

1247

1248

1249

1250

1251

1252

1253

1254

1255

1256

1257

1258

1259

1260

1261

1262

1263

1264

1265

1266

1267

1268

1269

1270

1271

1272

1273

1274

1275

1276

1277

1278

1279

1280

1281

r""" 

Crystals of Modified Nakajima Monomials 

 

AUTHORS: 

 

- Arthur Lubovsky: Initial version 

 

- Ben Salisbury: Initial version 

 

Let `Y_{i,k}`, for `i \in I` and `k \in \ZZ`, be a commuting set of 

variables, and let `\boldsymbol{1}` be a new variable which commutes with 

each `Y_{i,k}`. (Here, `I` represents the index set of a Cartan datum.) One 

may endow the structure of a crystal on the set `\widehat{\mathcal{M}}` of 

monomials of the form 

 

.. MATH:: 

 

M = \prod_{(i,k) \in I\times \ZZ_{\ge0}} Y_{i,k}^{y_i(k)}\boldsymbol{1}. 

 

Elements of `\widehat{\mathcal{M}}` are called *modified Nakajima monomials*. 

We will omit the `\boldsymbol{1}` from the end of a monomial if there exists 

at least one `y_i(k) \neq 0`. The crystal structure on this set is defined by 

 

.. MATH:: 

 

\begin{aligned} 

\mathrm{wt}(M) &= \sum_{i\in I} \Bigl( \sum_{k\ge 0} y_i(k) \Bigr) \Lambda_i, \\ 

\varphi_i(M) &= \max\Bigl\{ \sum_{0\le j \le k} y_i(j) : k\ge 0 \Bigr\}, \\ 

\varepsilon_i(M) &= \varphi_i(M) - \langle h_i, \mathrm{wt}(M) \rangle, \\ 

k_f = k_f(M) &= \min\Bigl\{ k\ge 0 : \varphi_i(M) = \sum_{0\le j\le k} y_i(j) \Bigr\}, \\ 

k_e = k_e(M) &= \max\Bigl\{ k\ge 0 : \varphi_i(M) = \sum_{0\le j\le k} y_i(j) \Bigr\}, 

\end{aligned} 

 

where `\{h_i : i \in I\}` and `\{\Lambda_i : i \in I \}` are the simple 

coroots and fundamental weights, respectively. With a chosen set of integers 

`C = (c_{ij})_{i\neq j}` such that `c_{ij}+c_{ji} =1`, one defines 

 

.. MATH:: 

 

A_{i,k} = Y_{i,k} Y_{i,k+1} \prod_{j\neq i} Y_{j,k+c_{ji}}^{a_{ji}}, 

 

where `(a_{ij})` is a Cartan matrix. Then 

 

.. MATH:: 

 

\begin{aligned} 

e_iM &= \begin{cases} 0 & \text{if } \varepsilon_i(M) = 0, \\ 

A_{i,k_e}M & \text{if } \varepsilon_i(M) > 0, \end{cases} \\ 

f_iM &= A_{i,k_f}^{-1} M. 

\end{aligned} 

 

It is shown in [KKS07]_ that the connected component of `\widehat{\mathcal{M}}` 

containing the element `\boldsymbol{1}`, which we denote by 

`\mathcal{M}(\infty)`, is crystal isomorphic to the crystal `B(\infty)`. 

 

Let `\widetilde{\mathcal{M}}` be `\widehat{\mathcal{M}}` as a set, and with 

crystal structure defined as on `\widehat{\mathcal{M}}` with the exception 

that 

 

.. MATH:: 

 

f_iM = \begin{cases} 0 & \text{if } \varphi_i(M) = 0, \\ 

A_{i,k_f}^{-1}M & \text{if } \varphi_i(M) > 0. \end{cases} 

 

Then Kashiwara [Kash03]_ showed that the connected component in 

`\widetilde{\mathcal{M}}` containing a monomial `M` such that `e_iM = 0`, for 

all `i \in I`, is crystal isomorphic to the irreducible highest weight 

crystal `B(\mathrm{wt}(M))`. 

 

WARNING: 

 

Monomial crystals depend on the choice of positive integers 

`C = (c_{ij})_{i\neq j}` satisfying the condition `c_{ij}+c_{ji}=1`. 

We have chosen such integers uniformly such that `c_{ij} = 1` if 

`i < j` and `c_{ij} = 0` if `i>j`. 

 

REFERENCES: 

 

.. [KKS07] \S.-J. Kang, J.-A. Kim, and D.-U. Shin. 

Modified Nakajima Monomials and the Crystal `B(\infty)`. 

J. Algebra **308**, pp. 524--535, 2007. 

 

.. [Kash03] \M. Kashiwara. 

Realizations of Crystals. 

Combinatorial and geometric representation theory (Seoul, 2001), 

Contemp. Math. **325**, Amer. Math. Soc., pp. 133--139, 2003. 

""" 

 

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

# Copyright (C) 2013 

# 

# Arthur Lubovsky (alubovsky at albany dot edu) 

# Ben Salisbury (ben dot salisbury at cmich dot edu) 

# 

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

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

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

 

from copy import copy 

from sage.structure.element import Element 

from sage.structure.parent import Parent 

from sage.structure.unique_representation import UniqueRepresentation 

from sage.categories.classical_crystals import ClassicalCrystals 

from sage.categories.highest_weight_crystals import HighestWeightCrystals 

from sage.categories.regular_crystals import RegularCrystals 

from sage.categories.infinite_enumerated_sets import InfiniteEnumeratedSets 

from sage.combinat.root_system.cartan_type import CartanType 

from sage.combinat.root_system.root_system import RootSystem 

from sage.rings.integer import Integer 

from sage.rings.infinity import Infinity 

from sage.rings.integer_ring import ZZ 

from sage.matrix.matrix_space import MatrixSpace 

 

import six 

 

 

class NakajimaMonomial(Element): 

r""" 

An element of the monomial crystal. 

 

Monomials of the form `Y_{i_1,k_1}^{y_1} \cdots Y_{i_t,k_t}^{y_t}`, 

where `i_1, \dots, i_t` are elements of the index set, `k_1, \dots, k_t` 

are nonnegative integers, and `y_1, \dots, y_t` are integers. 

 

EXAMPLES:: 

 

sage: M = crystals.infinity.NakajimaMonomials(['B',3,1]) 

sage: mg = M.module_generators[0] 

sage: mg 

1 

sage: mg.f_string([1,3,2,0,1,2,3,0,0,1]) 

Y(0,0)^-1 Y(0,1)^-1 Y(0,2)^-1 Y(0,3)^-1 Y(1,0)^-3 

Y(1,1)^-2 Y(1,2) Y(2,0)^3 Y(2,2) Y(3,0) Y(3,2)^-1 

 

An example using the `A` variables:: 

 

sage: M = crystals.infinity.NakajimaMonomials("A3") 

sage: M.set_variables('A') 

sage: mg = M.module_generators[0] 

sage: mg.f_string([1,2,3,2,1]) 

A(1,0)^-1 A(1,1)^-1 A(2,0)^-2 A(3,0)^-1 

sage: mg.f_string([3,2,1]) 

A(1,2)^-1 A(2,1)^-1 A(3,0)^-1 

sage: M.set_variables('Y') 

""" 

 

def __init__(self, parent, Y, A): 

r""" 

INPUT: 

 

- ``d`` -- a dictionary of with pairs of the form ``{(i,k): y}`` 

 

EXAMPLES:: 

 

sage: M = crystals.infinity.NakajimaMonomials("C5") 

sage: mg = M.module_generators[0] 

sage: TestSuite(mg).run() 

""" 

self._Y = Y 

self._A = A 

Element.__init__(self, parent) 

 

def _repr_(self): 

r""" 

Return a string representation of ``self``. 

 

EXAMPLES:: 

 

sage: M = crystals.infinity.NakajimaMonomials(['A',5,2]) 

sage: x = M({(1,0):1, (2,2):-2, (0,5):10}); x 

Y(0,5)^10 Y(1,0) Y(2,2)^-2 

sage: M.set_variables('A') 

sage: x 

A(1,0)^-2 A(1,1)^-2 A(2,0)^-4 A(2,1)^-2 A(3,0)^-2 

sage: M.set_variables('Y') 

""" 

return getattr(self, '_repr_' + self.parent()._variable)() 

 

def _repr_Y(self): 

r""" 

Return a string representation of ``self`` in the `Y` variables. 

 

EXAMPLES:: 

 

sage: M = crystals.infinity.NakajimaMonomials(['A',5,2]) 

sage: M({(1,0):1,(2,2):-2,(0,5):10}) 

Y(0,5)^10 Y(1,0) Y(2,2)^-2 

""" 

if not self._Y: 

return "1" 

 

L = sorted(six.iteritems(self._Y), key=lambda x: (x[0][0], x[0][1])) 

exp = lambda e: "^{}".format(e) if e != 1 else "" 

return ' '.join("Y({},{})".format(mon[0][0], mon[0][1]) + exp(mon[1]) 

for mon in L) 

 

def _repr_A(self): 

r""" 

Return a string representation of ``self`` in the `A` variables. 

 

EXAMPLES:: 

 

sage: M = crystals.infinity.NakajimaMonomials(['B',4,1]) 

sage: m = M.module_generators[0].f_string([4,2,1]) 

sage: m._repr_A() 

'A(1,1)^-1 A(2,0)^-1 A(4,0)^-1' 

""" 

try: 

Y = {(i,0): c for i,c in self.parent().hw} 

except Exception: 

Y = {} 

 

if not Y and not self._A: 

return "1" 

 

L = sorted(six.iteritems(Y), key=lambda x: (x[0][0], x[0][1])) 

exp = lambda e: "^{}".format(e) if e != 1 else "" 

ret = ' '.join("Y({},{})".format(mon[0][0], mon[0][1]) + exp(mon[1]) 

for mon in L) 

if not self._A: 

return ret 

if Y: 

ret += ' ' 

L = sorted(six.iteritems(self._A), key=lambda x: (x[0][0], x[0][1])) 

return ret + ' '.join("A({},{})".format(mon[0][0], mon[0][1]) + exp(mon[1]) 

for mon in L) 

 

def __hash__(self): 

r""" 

TESTS:: 

 

sage: M = crystals.infinity.NakajimaMonomials(['C',5]) 

sage: m1 = M.module_generators[0].f(1) 

sage: hash(m1) 

4715601665014767730 # 64-bit 

-512614286 # 32-bit 

""" 

return hash(frozenset(tuple(six.iteritems(self._Y)))) 

 

def __eq__(self, other): 

r""" 

EXAMPLES:: 

 

sage: M = crystals.infinity.NakajimaMonomials(['C',5]) 

sage: m1 = M.module_generators[0].f(1) 

sage: m2 = M.module_generators[0].f(2) 

sage: m1.__eq__(m2) 

False 

sage: m1.__eq__(m1) 

True 

""" 

if isinstance(other, NakajimaMonomial): 

return self._Y == other._Y 

return self._Y == other 

 

def __ne__(self, other): 

r""" 

EXAMPLES:: 

 

sage: La = RootSystem(['A',2]).weight_lattice().fundamental_weights() 

sage: M = crystals.NakajimaMonomials(['A',2],La[1]+La[2]) 

sage: m0 = M.module_generators[0] 

sage: m = M.module_generators[0].f(1).f(2).f(2).f(1) 

sage: m.__ne__(m0) 

True 

sage: m.__ne__(m) 

False 

""" 

return not self == other 

 

def __lt__(self, other): 

r""" 

EXAMPLES:: 

 

sage: M = crystals.infinity.NakajimaMonomials(['F',4]) 

sage: mg = M.module_generators[0] 

sage: m = mg.f(4) 

sage: m.__lt__(mg) 

False 

sage: mg.__lt__(m) 

False 

""" 

return False 

 

def _latex_(self): 

r""" 

Return a `\LaTeX` representation of ``self``. 

 

EXAMPLES:: 

 

sage: M = crystals.infinity.NakajimaMonomials(['G',2,1]) 

sage: x = M.module_generators[0].f_string([1,0,2]) 

sage: latex(x) 

Y_{0,0}^{-1} Y_{1,0}^{-1} Y_{1,1}^{2} Y_{2,0} Y_{2,1}^{-1} 

sage: M.set_variables('A') 

sage: latex(x) 

A_{0,0}^{-1} A_{1,0}^{-1} A_{2,0}^{-1} 

sage: M.set_variables('Y') 

""" 

return getattr(self, '_latex_' + self.parent()._variable)() 

 

def _latex_Y(self): 

r""" 

Return a `\LaTeX` representation of ``self`` in the `Y` variables. 

 

EXAMPLES:: 

 

sage: M = crystals.infinity.NakajimaMonomials(['G',2,1]) 

sage: M.module_generators[0].f_string([1,0,2])._latex_Y() 

'Y_{0,0}^{-1} Y_{1,0}^{-1} Y_{1,1}^{2} Y_{2,0} Y_{2,1}^{-1} ' 

""" 

if not self._Y: 

return "\\boldsymbol{1}" 

 

L = sorted(six.iteritems(self._Y), key=lambda x:(x[0][0],x[0][1])) 

return_str = '' 

for x in L: 

if x[1] != 1: 

return_str += "Y_{%s,%s}"%(x[0][0],x[0][1]) + "^{%s} "%x[1] 

else: 

return_str += "Y_{%s,%s} "%(x[0][0],x[0][1]) 

return return_str 

 

def _latex_A(self): 

r""" 

Return a `\LaTeX` representation of ``self`` in the `A` variables. 

 

EXAMPLES:: 

 

sage: M = crystals.infinity.NakajimaMonomials(['C',4,1]) 

sage: m = M.module_generators[0].f_string([4,2,3]) 

sage: m._latex_A() 

'A_{2,0}^{-1} A_{3,1}^{-1} A_{4,0}^{-1} ' 

""" 

try: 

Y = {(i,0): c for i,c in self.parent().hw} 

except Exception: 

Y = {} 

 

if not Y and not self._A: 

return "\\boldsymbol{1}" 

 

L = sorted(six.iteritems(Y), key=lambda x:(x[0][0],x[0][1])) 

return_str = '' 

for x in L: 

if x[1] != 1: 

return_str += "Y_{%s,%s}"%(x[0][0],x[0][1]) + "^{%s} "%x[1] 

else: 

return_str += "Y_{%s,%s} "%(x[0][0],x[0][1]) 

L = sorted(six.iteritems(self._A), key=lambda x:(x[0][0],x[0][1])) 

for x in L: 

if x[1] != 1: 

return_str += "A_{%s,%s}"%(x[0][0],x[0][1]) + "^{%s} "%x[1] 

else: 

return_str += "A_{%s,%s} "%(x[0][0],x[0][1]) 

return return_str 

 

def _classical_weight(self): 

r""" 

Return the weight of ``self`` as an element of the classical version of 

``self.parent().weight_lattice_realization``. 

 

EXAMPLES:: 

 

sage: M = crystals.infinity.NakajimaMonomials(['D',4,2]) 

sage: m = M.module_generators[0].f_string([0,3,2,0,1]) 

sage: m._classical_weight() 

-2*Lambda[0] + Lambda[1] 

 

sage: M = crystals.infinity.NakajimaMonomials(['E',6]) 

sage: m = M.module_generators[0].f_string([1,5,2,6,3]) 

sage: m._classical_weight() 

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

""" 

P = self.parent().weight_lattice_realization() 

La = P.fundamental_weights() 

return P(sum(v*La[k[0]] for k,v in six.iteritems(self._Y))) 

 

def weight_in_root_lattice(self): 

r""" 

Return the weight of ``self`` as an element of the root lattice. 

 

EXAMPLES:: 

 

sage: M = crystals.infinity.NakajimaMonomials(['F',4]) 

sage: m = M.module_generators[0].f_string([3,3,1,2,4]) 

sage: m.weight_in_root_lattice() 

-alpha[1] - alpha[2] - 2*alpha[3] - alpha[4] 

 

sage: M = crystals.infinity.NakajimaMonomials(['B',3,1]) 

sage: mg = M.module_generators[0] 

sage: m = mg.f_string([1,3,2,0,1,2,3,0,0,1]) 

sage: m.weight_in_root_lattice() 

-3*alpha[0] - 3*alpha[1] - 2*alpha[2] - 2*alpha[3] 

 

sage: M = crystals.infinity.NakajimaMonomials(['C',3,1]) 

sage: m = M.module_generators[0].f_string([3,0,1,2,0]) 

sage: m.weight_in_root_lattice() 

-2*alpha[0] - alpha[1] - alpha[2] - alpha[3] 

""" 

Q = RootSystem(self.parent().cartan_type()).root_lattice() 

al = Q.simple_roots() 

return Q.sum(e*al[k[0]] for k,e in six.iteritems(self._A)) 

 

def weight(self): 

r""" 

Return the weight of ``self`` as an element of the weight lattice. 

 

EXAMPLES:: 

 

sage: C = crystals.infinity.NakajimaMonomials(['A',1,1]) 

sage: v = C.highest_weight_vector() 

sage: v.f(1).weight() + v.f(0).weight() 

-delta 

 

sage: M = crystals.infinity.NakajimaMonomials(['A',4,2]) 

sage: m = M.highest_weight_vector().f_string([1,2,0,1]) 

sage: m.weight() 

2*Lambda[0] - Lambda[1] - delta 

""" 

P = self.parent().weight_lattice_realization() 

return P(self.weight_in_root_lattice()) 

 

def epsilon(self, i): 

r""" 

Return the value of `\varepsilon_i` on ``self``. 

 

INPUT: 

 

- ``i`` -- an element of the index set 

 

EXAMPLES:: 

 

sage: M = crystals.infinity.NakajimaMonomials(['G',2,1]) 

sage: m = M.module_generators[0].f(2) 

sage: [m.epsilon(i) for i in M.index_set()] 

[0, 0, 1] 

 

sage: M = crystals.infinity.NakajimaMonomials(['C',4,1]) 

sage: m = M.module_generators[0].f_string([4,2,3]) 

sage: [m.epsilon(i) for i in M.index_set()] 

[0, 0, 0, 1, 0] 

""" 

if i not in self.parent().index_set(): 

raise ValueError("i must be an element of the index set") 

h = self.parent().weight_lattice_realization().simple_coroots() 

return self.phi(i) - self._classical_weight().scalar(h[i]) 

 

def phi(self, i): 

r""" 

Return the value of `\varphi_i` on ``self``. 

 

INPUT: 

 

- ``i`` -- an element of the index set 

 

EXAMPLES:: 

 

sage: M = crystals.infinity.NakajimaMonomials(['D',4,3]) 

sage: m = M.module_generators[0].f(1) 

sage: [m.phi(i) for i in M.index_set()] 

[1, -1, 1] 

 

sage: M = crystals.infinity.NakajimaMonomials(['C',4,1]) 

sage: m = M.module_generators[0].f_string([4,2,3]) 

sage: [m.phi(i) for i in M.index_set()] 

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

""" 

if i not in self.parent().index_set(): 

raise ValueError("i must be an element of the index set") 

if not self._Y or all(x[0] != i for x in self._Y): 

return ZZ.zero() 

 

d = copy(self._Y) 

K = max(x[1] for x in d if x[0] == i) 

for a in range(K): 

if (i,a) in d: 

continue 

else: 

d[(i,a)] = 0 

S = sorted((x for x in six.iteritems(d) if x[0][0] == i), key=lambda x: x[0][1]) 

return max(sum(S[k][1] for k in range(s)) for s in range(1,len(S)+1)) 

 

def _ke(self, i): 

r""" 

Return the value `k_e` with respect to ``i`` and ``self``. 

 

INPUT: 

 

- ``i`` -- an element of the index set 

 

EXAMPLES:: 

 

sage: M = crystals.infinity.NakajimaMonomials(['D',4,3]) 

sage: m = M.module_generators[0].f(1) 

sage: [m._ke(i) for i in M.index_set()] 

[+Infinity, 0, +Infinity] 

""" 

h = self.parent().weight_lattice_realization().simple_coroots() 

phi = self.phi(i) 

if phi == self._classical_weight().scalar(h[i]): # self.epsilon(i) == 0 

return Infinity 

 

d = copy(self._Y) 

K = max(x[1] for x in d if x[0] == i) 

for a in range(K): 

if (i,a) in d: 

continue 

else: 

d[(i,a)] = 0 

total = ZZ.zero() 

L = [] 

S = sorted((x for x in six.iteritems(d) if x[0][0] == i), key=lambda x: x[0][1]) 

for var,exp in S: 

total += exp 

if total == phi: 

L.append(var[1]) 

 

return max(L) if L else ZZ.zero() 

 

def _kf(self, i): 

r""" 

Return the value `k_f` with respect to ``i`` and ``self``. 

 

INPUT: 

 

- ``i`` -- an element of the index set 

 

EXAMPLES:: 

 

sage: M = crystals.infinity.NakajimaMonomials(['F',4,1]) 

sage: m = M.module_generators[0].f_string([0,1,4,3]) 

sage: [m._kf(i) for i in M.index_set()] 

[0, 0, 2, 0, 0] 

""" 

if all(i != x[0] for x in self._Y): 

return ZZ.zero() 

 

d = copy(self._Y) 

K = max(key[1] for key in d if key[0] == i) 

for a in range(K): 

if (i,a) in d: 

continue 

else: 

d[(i,a)] = 0 

S = sorted((x for x in six.iteritems(d) if x[0][0] == i), key=lambda x: x[0][1]) 

sum = 0 

phi = self.phi(i) 

for var,exp in S: 

sum += exp 

if sum == phi: 

return var[1] 

 

def e(self, i): 

r""" 

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

 

INPUT: 

 

- ``i`` -- an element of the index set 

 

EXAMPLES:: 

 

sage: M = crystals.infinity.NakajimaMonomials(['E',7,1]) 

sage: m = M.module_generators[0].f_string([0,1,4,3]) 

sage: [m.e(i) for i in M.index_set()] 

[None, 

None, 

None, 

Y(0,0)^-1 Y(1,1)^-1 Y(2,1) Y(3,0) Y(3,1) Y(4,0)^-1 Y(4,1)^-1 Y(5,0), 

None, 

None, 

None, 

None] 

 

sage: M = crystals.infinity.NakajimaMonomials("C5") 

sage: m = M.module_generators[0].f_string([1,3]) 

sage: [m.e(i) for i in M.index_set()] 

[Y(2,1) Y(3,0)^-1 Y(3,1)^-1 Y(4,0), 

None, 

Y(1,0)^-1 Y(1,1)^-1 Y(2,0), 

None, 

None] 

 

sage: M = crystals.infinity.NakajimaMonomials(['D',4,1]) 

sage: M.set_variables('A') 

sage: m = M.module_generators[0].f_string([4,2,3,0]) 

sage: [m.e(i) for i in M.index_set()] 

[A(2,1)^-1 A(3,1)^-1 A(4,0)^-1, 

None, 

None, 

A(0,2)^-1 A(2,1)^-1 A(4,0)^-1, 

None] 

sage: M.set_variables('Y') 

""" 

if i not in self.parent().index_set(): 

raise ValueError("i must be an element of the index set") 

if self.epsilon(i) == 0: 

return None 

 

newdict = copy(self._Y) 

ke = self._ke(i) 

Aik = {(i, ke): 1, (i, ke+1): 1} 

ct = self.parent().cartan_type() 

cm = ct.cartan_matrix() 

shift = 0 

if self.parent().cartan_type().is_finite(): 

shift = 1 

for j_index,j in enumerate(self.parent().index_set()): 

if i == j: 

continue 

c = self.parent()._c[j_index,i-shift] 

if cm[j_index,i-shift] != 0: 

Aik[(j, ke+c)] = cm[j_index,i-shift] 

# Multiply by Aik 

for key,value in six.iteritems(Aik): 

if key in newdict: 

if newdict[key] == -value: # The result would be a 0 exponent 

del newdict[key] 

else: 

newdict[key] += value 

else: 

newdict[key] = value 

A = copy(self._A) 

A[(i,ke)] = A.get((i,ke),0) + 1 

if not A[(i,ke)]: 

del A[(i,ke)] 

return self.__class__(self.parent(), newdict, A) 

 

def f(self, i): 

r""" 

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

 

INPUT: 

 

- ``i`` -- an element of the index set 

 

EXAMPLES:: 

 

sage: M = crystals.infinity.NakajimaMonomials("B4") 

sage: m = M.module_generators[0].f_string([1,3,4]) 

sage: [m.f(i) for i in M.index_set()] 

[Y(1,0)^-2 Y(1,1)^-2 Y(2,0)^2 Y(2,1) Y(3,0)^-1 Y(4,0) Y(4,1)^-1, 

Y(1,0)^-1 Y(1,1)^-1 Y(1,2) Y(2,0) Y(2,2)^-1 Y(3,0)^-1 Y(3,1) Y(4,0) Y(4,1)^-1, 

Y(1,0)^-1 Y(1,1)^-1 Y(2,0) Y(2,1)^2 Y(3,0)^-2 Y(3,1)^-1 Y(4,0)^3 Y(4,1)^-1, 

Y(1,0)^-1 Y(1,1)^-1 Y(2,0) Y(2,1) Y(3,0)^-1 Y(3,1) Y(4,1)^-2] 

""" 

if i not in self.parent().index_set(): 

raise ValueError("i must be an element of the index set") 

newdict = copy(self._Y) 

kf = self._kf(i) 

Aik = {(i, kf): -1, (i, kf+1): -1} 

ct = self.parent().cartan_type() 

cm = ct.cartan_matrix() 

shift = 0 

if ct.is_finite(): 

shift = 1 

for j_index,j in enumerate(self.parent().index_set()): 

if i == j: 

continue 

c = self.parent()._c[j_index,i-shift] 

if cm[j_index,i-shift] != 0: 

Aik[(j, kf+c)] = -cm[j_index,i-shift] 

# Multiply by Aik 

for key,value in six.iteritems(Aik): 

if key in newdict: 

if newdict[key] == -value: # The result would be a 0 exponent 

del newdict[key] 

else: 

newdict[key] += value 

else: 

newdict[key] = value 

A = copy(self._A) 

A[(i,kf)] = A.get((i,kf),0) - 1 

if not A[(i,kf)]: 

del A[(i,kf)] 

return self.__class__(self.parent(), newdict, A) 

 

class InfinityCrystalOfNakajimaMonomials(UniqueRepresentation, Parent): 

r""" 

Crystal `B(\infty)` in terms of (modified) Nakajima monomials. 

 

Let `Y_{i,k}`, for `i \in I` and `k \in \ZZ`, be a commuting set of 

variables, and let `\boldsymbol{1}` be a new variable which commutes 

with each `Y_{i,k}`. (Here, `I` represents the index set of a Cartan 

datum.) One may endow the structure of a crystal on the 

set `\widehat{\mathcal{M}}` of monomials of the form 

 

.. MATH:: 

 

M = \prod_{(i,k) \in I\times \ZZ_{\ge0}} Y_{i,k}^{y_i(k)}\boldsymbol{1}. 

 

Elements of `\widehat{\mathcal{M}}` are called 

*modified Nakajima monomials*. We will omit the `\boldsymbol{1}` 

from the end of a monomial if there exists at least one `y_i(k) \neq 0`. 

The crystal structure on this set is defined by 

 

.. MATH:: 

 

\begin{aligned} 

\mathrm{wt}(M) & = \sum_{i\in I} \Bigl( \sum_{k \ge 0} 

y_i(k) \Bigr) \Lambda_i, \\ 

\varphi_i(M) & = \max\Bigl\{ \sum_{0 \le j \le k} y_i(j) : 

k \ge 0 \Bigr\}, \\ 

\varepsilon_i(M) & = \varphi_i(M) - 

\langle h_i, \mathrm{wt}(M) \rangle, \\ 

k_f = k_f(M) & = \min\Bigl\{ k \ge 0 : 

\varphi_i(M) = \sum_{0 \le j \le k} y_i(j) \Bigr\}, \\ 

k_e = k_e(M) & = \max\Bigl\{ k \ge 0 : 

\varphi_i(M) = \sum_{0 \le j \le k} y_i(j) \Bigr\}, 

\end{aligned} 

 

where `\{h_i : i \in I\}` and `\{\Lambda_i : i \in I \}` are the simple 

coroots and fundamental weights, respectively. With a chosen set of 

non-negative integers `C = (c_{ij})_{i\neq j}` such that 

`c_{ij} + c_{ji} = 1`, one defines 

 

.. MATH:: 

 

A_{i,k} = Y_{i,k} Y_{i,k+1} \prod_{j\neq i} Y_{j,k+c_{ji}}^{a_{ji}}, 

 

where `(a_{ij})_{i,j \in I}` is a Cartan matrix. Then 

 

.. MATH:: 

 

\begin{aligned} 

e_iM &= \begin{cases} 0 & \text{if } \varepsilon_i(M) = 0, \\ 

A_{i,k_e}M & \text{if } \varepsilon_i(M) > 0, \end{cases} \\ 

f_iM &= A_{i,k_f}^{-1} M. 

\end{aligned} 

 

It is shown in [KKS07]_ that the connected component of 

`\widehat{\mathcal{M}}` containing the element `\boldsymbol{1}`, 

which we denote by `\mathcal{M}(\infty)`, is crystal isomorphic 

to the crystal `B(\infty)`. 

 

INPUT: 

 

- ``cartan_type`` -- a Cartan type 

 

- ``c`` -- (optional) the matrix `(c_{ij})_{i,j \in I}` such that 

`c_{ii} = 0` for all `i \in I`, `c_{ij} \in \ZZ_{>0}` for all 

`i,j \in I`, and `c_{ij} + c_{ji} = 1` for all `i \neq j`; the 

default is `c_{ij} = 0` if `i < j` and `0` otherwise 

 

EXAMPLES:: 

 

sage: B = crystals.infinity.Tableaux("C3") 

sage: S = B.subcrystal(max_depth=4) 

sage: G = B.digraph(subset=S) # long time 

sage: M = crystals.infinity.NakajimaMonomials("C3") # long time 

sage: T = M.subcrystal(max_depth=4) # long time 

sage: H = M.digraph(subset=T) # long time 

sage: G.is_isomorphic(H,edge_labels=True) # long time 

True 

 

sage: M = crystals.infinity.NakajimaMonomials(['A',2,1]) 

sage: T = M.subcrystal(max_depth=3) 

sage: H = M.digraph(subset=T) # long time 

sage: Y = crystals.infinity.GeneralizedYoungWalls(2) 

sage: YS = Y.subcrystal(max_depth=3) 

sage: YG = Y.digraph(subset=YS) # long time 

sage: YG.is_isomorphic(H,edge_labels=True) # long time 

True 

 

sage: M = crystals.infinity.NakajimaMonomials("D4") 

sage: B = crystals.infinity.Tableaux("D4") 

sage: MS = M.subcrystal(max_depth=3) 

sage: BS = B.subcrystal(max_depth=3) 

sage: MG = M.digraph(subset=MS) # long time 

sage: BG = B.digraph(subset=BS) # long time 

sage: BG.is_isomorphic(MG,edge_labels=True) # long time 

True 

""" 

@staticmethod 

def _normalize_c(c, n): 

""" 

Normalize the input ``c``. 

 

EXAMPLES:: 

 

sage: from sage.combinat.crystals.monomial_crystals import InfinityCrystalOfNakajimaMonomials 

sage: InfinityCrystalOfNakajimaMonomials._normalize_c(None, 4) 

[0 1 1 1] 

[0 0 1 1] 

[0 0 0 1] 

[0 0 0 0] 

sage: c = matrix([[0,1,1],[0,0,0],[0,1,0]]); c 

[0 1 1] 

[0 0 0] 

[0 1 0] 

sage: c.is_mutable() 

True 

sage: C = InfinityCrystalOfNakajimaMonomials._normalize_c(c, 3); C 

[0 1 1] 

[0 0 0] 

[0 1 0] 

sage: C.is_mutable() 

False 

 

TESTS:: 

 

sage: c = matrix([[0,1],[0,1]]) 

sage: C = InfinityCrystalOfNakajimaMonomials._normalize_c(c, 2) 

Traceback (most recent call last): 

... 

ValueError: the c matrix must have 0's on the diagonal 

sage: c = matrix([[0,2],[-1,0]]) 

sage: C = InfinityCrystalOfNakajimaMonomials._normalize_c(c, 2) 

Traceback (most recent call last): 

... 

ValueError: the c matrix must have non-negative entries 

sage: c = matrix([[0,1],[1,0]]) 

sage: C = InfinityCrystalOfNakajimaMonomials._normalize_c(c, 2) 

Traceback (most recent call last): 

... 

ValueError: transpose entries do not sum to 1 

""" 

if c is None: 

# Default is i < j <=> c_{ij} = 1 (0 otherwise) 

c = [[1 if i < j else 0 for j in range(n)] for i in range(n)] 

MS = MatrixSpace(ZZ, n, n) 

c = MS(c) 

c.set_immutable() 

if any(c[i,i] != 0 for i in range(n)): 

raise ValueError("the c matrix must have 0's on the diagonal") 

if any(c[i,j] + c[j,i] != 1 for i in range(n) for j in range(i)): 

raise ValueError("transpose entries do not sum to 1") 

if any(c[i,j] < 0 or c[j,i] < 0 for i in range(n) for j in range(i)): 

raise ValueError("the c matrix must have non-negative entries") 

return c 

 

@staticmethod 

def __classcall_private__(cls, ct, c=None, use_Y=None): 

r""" 

Normalize input to ensure a unique representation. 

 

INPUT: 

 

- ``ct`` -- a Cartan type 

 

EXAMPLES:: 

 

sage: M = crystals.infinity.NakajimaMonomials("E8") 

sage: M1 = crystals.infinity.NakajimaMonomials(['E',8]) 

sage: M2 = crystals.infinity.NakajimaMonomials(CartanType(['E',8])) 

sage: M is M1 is M2 

True 

""" 

if use_Y is not None: 

from sage.misc.superseded import deprecation 

deprecation(18895, 'use_Y is deprecated; use the set_variables() method instead.') 

else: 

use_Y = True 

 

cartan_type = CartanType(ct) 

n = len(cartan_type.index_set()) 

c = InfinityCrystalOfNakajimaMonomials._normalize_c(c, n) 

M = super(InfinityCrystalOfNakajimaMonomials, cls).__classcall__(cls, cartan_type, c) 

if not use_Y: 

M.set_variables('A') 

else: 

M.set_variables('Y') 

return M 

 

def __init__(self, ct, c, category=None): 

r""" 

EXAMPLES:: 

 

sage: Minf = crystals.infinity.NakajimaMonomials(['A',3]) 

sage: TestSuite(Minf).run() # long time 

""" 

self._cartan_type = ct 

self._c = c 

self._variable = 'Y' 

 

if category is None: 

category = (HighestWeightCrystals(), InfiniteEnumeratedSets()) 

Parent.__init__(self, category=category) 

self.module_generators = (self.element_class(self, {}, {}),) 

 

def _element_constructor_(self, Y=None, A=None): 

r""" 

Construct an element of ``self`` from ``Y``. 

 

INPUT: 

 

- ``Y`` -- a dictionary whose key is a pair and whose value 

is an integer 

- ``A`` -- a dictionary whose key is a pair and whose value 

is an integer 

 

EXAMPLES:: 

 

sage: M = crystals.infinity.NakajimaMonomials(['D',4,1]) 

sage: m = M({(1,0):-1,(1,1):-1,(2,0):1}) 

sage: m 

Y(1,0)^-1 Y(1,1)^-1 Y(2,0) 

 

sage: M = crystals.infinity.NakajimaMonomials(['A',2,1]) 

sage: m = M(A={(0,1): -1, (1,1): -2, (2,0): -1, (2,1): -1}) 

sage: m._repr_A() 

'A(0,1)^-1 A(1,1)^-2 A(2,0)^-1 A(2,1)^-1' 

sage: m 

Y(0,2)^2 Y(1,2)^-1 Y(2,0)^-1 Y(2,1) Y(2,2)^-1 

sage: m == M.highest_weight_vector().f_string([2,0,1,2,1]) 

True 

""" 

if A is None: 

if Y is None: 

return self.module_generators[0] 

# This is a crude way to determine the A, but it works 

hw,path = self.element_class(self, Y, {}).to_highest_weight() 

hw._A = {} 

return hw.f_string(reversed(path)) 

elif Y is None or Y == 0: 

# The Y == 0 check is because the parent's __call__ has that 

# as the first default value 

ct = self.cartan_type() 

cm = ct.cartan_matrix() 

I = self.index_set() 

shift = 0 

if ct.is_finite(): 

shift = 1 

Y = {} 

for k,v in six.iteritems(A): 

Y[k] = Y.get(k, 0) + v 

Y[(k[0],k[1]+1)] = Y.get((k[0],k[1]+1), 0) + v 

for j_index,j in enumerate(I): 

if k[0] == j: 

continue 

c = self._c[j_index,k[0]-shift] 

if cm[j_index,k[0]-shift] != 0: 

Y[(j,k[1]+c)] = Y.get((j,k[1]+c), 0) + v*cm[j_index,k[0]-shift] 

for k in list(Y): 

if Y[k] == 0: 

del Y[k] 

return self.element_class(self, Y, A) 

 

def _repr_(self): 

r""" 

EXAMPLES:: 

 

sage: M = crystals.infinity.NakajimaMonomials(['D',4,1]) 

sage: m = M({(1,0):-1,(1,1):-1,(2,0):1}) 

sage: m 

Y(1,0)^-1 Y(1,1)^-1 Y(2,0) 

""" 

return "Infinity Crystal of modified Nakajima monomials of type {}".format(self._cartan_type) 

 

def c(self): 

""" 

Return the matrix `c_{ij}` of ``self``. 

 

EXAMPLES:: 

 

sage: La = RootSystem(['B',3]).weight_lattice().fundamental_weights() 

sage: M = crystals.NakajimaMonomials(La[1]+La[2]) 

sage: M.c() 

[0 1 1] 

[0 0 1] 

[0 0 0] 

 

sage: c = Matrix([[0,0,1],[1,0,0],[0,1,0]]) 

sage: La = RootSystem(['A',2,1]).weight_lattice(extended=True).fundamental_weights() 

sage: M = crystals.NakajimaMonomials(2*La[1], c=c) 

sage: M.c() == c 

True 

""" 

return self._c 

 

def cardinality(self): 

r""" 

Return the cardinality of ``self``, which is always `\infty`. 

 

EXAMPLES:: 

 

sage: M = crystals.infinity.NakajimaMonomials(['A',5,2]) 

sage: M.cardinality() 

+Infinity 

""" 

return Infinity 

 

def set_variables(self, letter): 

r""" 

Set the type of monomials to use for the element output. 

 

If the `A` variables are used, the output is written as 

`\prod_{i\in I} Y_{i,0}^{\lambda_i} \prod_{i,k} A_{i,k}^{c_{i,k}}`, where 

`\sum_{i \in I} \lambda_i \Lambda_i` is the corresponding 

dominant weight. 

 

INPUT: 

 

- ``letter`` -- can be one of the following: 

 

* ``'Y'`` - use `Y_{i,k}`, corresponds to fundamental weights 

* ``'A'`` - use `A_{i,k}`, corresponds to simple roots 

 

EXAMPLES:: 

 

sage: M = crystals.infinity.NakajimaMonomials(['A', 4]) 

sage: elt = M.highest_weight_vector().f_string([2,1,3,2,3,2,4,3]) 

sage: elt 

Y(1,2) Y(2,0)^-1 Y(2,2)^-1 Y(3,0)^-1 Y(3,2)^-1 Y(4,0) 

sage: M.set_variables('A') 

sage: elt 

A(1,1)^-1 A(2,0)^-1 A(2,1)^-2 A(3,0)^-2 A(3,1)^-1 A(4,0)^-1 

sage: M.set_variables('Y') 

 

:: 

 

sage: La = RootSystem(['A',2]).weight_lattice().fundamental_weights() 

sage: M = crystals.NakajimaMonomials(La[1]+La[2]) 

sage: lw = M.lowest_weight_vectors()[0] 

sage: lw 

Y(1,2)^-1 Y(2,1)^-1 

sage: M.set_variables('A') 

sage: lw 

Y(1,0) Y(2,0) A(1,0)^-1 A(1,1)^-1 A(2,0)^-2 

sage: M.set_variables('Y') 

""" 

if letter not in ['Y', 'A']: 

raise ValueError("invalid monomial type") 

self._variable = letter 

 

def get_variables(self): 

""" 

Return the type of monomials to use for the element output. 

 

EXAMPLES:: 

 

sage: M = crystals.infinity.NakajimaMonomials(['A', 4]) 

sage: M.get_variables() 

'Y' 

""" 

return self._variable 

 

Element = NakajimaMonomial 

 

class CrystalOfNakajimaMonomialsElement(NakajimaMonomial): 

r""" 

Element class for 

:class:`~sage.combinat.crystals.monomial_crystals.CrystalOfNakajimaMonomials`. 

 

The `f_i` operators need to be modified from the version in 

:class:`~sage.combinat.crystals.monomial_crystalsNakajimaMonomial` 

in order to create irreducible highest weight realizations. 

This modified `f_i` is defined as 

 

.. MATH:: 

 

f_iM = \begin{cases} 0 & \text{if } \varphi_i(M) = 0, \\ 

A_{i,k_f}^{-1}M & \text{if } \varphi_i(M) > 0. \end{cases} 

 

EXAMPLES:: 

 

sage: La = RootSystem(['A',5,2]).weight_lattice(extended=True).fundamental_weights() 

sage: M = crystals.NakajimaMonomials(['A',5,2],3*La[0]) 

sage: m = M.module_generators[0].f(0); m 

Y(0,0)^2 Y(0,1)^-1 Y(2,0) 

sage: TestSuite(m).run() 

""" 

def f(self, i): 

r""" 

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

 

INPUT: 

 

- ``i`` -- an element of the index set 

 

EXAMPLES:: 

 

sage: La = RootSystem(['A',5,2]).weight_lattice(extended=True).fundamental_weights() 

sage: M = crystals.NakajimaMonomials(['A',5,2],3*La[0]) 

sage: m = M.module_generators[0] 

sage: [m.f(i) for i in M.index_set()] 

[Y(0,0)^2 Y(0,1)^-1 Y(2,0), None, None, None] 

 

:: 

 

sage: M = crystals.infinity.NakajimaMonomials("E8") 

sage: M.set_variables('A') 

sage: m = M.module_generators[0].f_string([4,2,3,8]) 

sage: m 

A(2,1)^-1 A(3,1)^-1 A(4,0)^-1 A(8,0)^-1 

sage: [m.f(i) for i in M.index_set()] 

[A(1,2)^-1 A(2,1)^-1 A(3,1)^-1 A(4,0)^-1 A(8,0)^-1, 

A(2,0)^-1 A(2,1)^-1 A(3,1)^-1 A(4,0)^-1 A(8,0)^-1, 

A(2,1)^-1 A(3,0)^-1 A(3,1)^-1 A(4,0)^-1 A(8,0)^-1, 

A(2,1)^-1 A(3,1)^-1 A(4,0)^-1 A(4,1)^-1 A(8,0)^-1, 

A(2,1)^-1 A(3,1)^-1 A(4,0)^-1 A(5,0)^-1 A(8,0)^-1, 

A(2,1)^-1 A(3,1)^-1 A(4,0)^-1 A(6,0)^-1 A(8,0)^-1, 

A(2,1)^-1 A(3,1)^-1 A(4,0)^-1 A(7,1)^-1 A(8,0)^-1, 

A(2,1)^-1 A(3,1)^-1 A(4,0)^-1 A(8,0)^-2] 

sage: M.set_variables('Y') 

""" 

if self.phi(i) == 0: 

return None 

return super(CrystalOfNakajimaMonomialsElement, self).f(i) 

 

def weight(self): 

r""" 

Return the weight of ``self`` as an element of the weight lattice. 

 

EXAMPLES:: 

 

sage: La = RootSystem("A2").weight_lattice().fundamental_weights() 

sage: M = crystals.NakajimaMonomials("A2",La[1]+La[2]) 

sage: M.module_generators[0].weight() 

(2, 1, 0) 

""" 

P = self.parent().weight_lattice_realization() 

return P(self.weight_in_root_lattice()) + P(self.parent().hw) 

 

class CrystalOfNakajimaMonomials(InfinityCrystalOfNakajimaMonomials): 

r""" 

Let `\widetilde{\mathcal{M}}` be `\widehat{\mathcal{M}}` as a set, and with 

crystal structure defined as on `\widehat{\mathcal{M}}` with the exception 

that 

 

.. MATH:: 

 

f_iM = \begin{cases} 0 & \text{if } \varphi_i(M) = 0, \\ 

A_{i,k_f}^{-1}M & \text{if } \varphi_i(M) > 0. \end{cases} 

 

Then Kashiwara [Kash03]_ showed that the connected component in 

`\widetilde{\mathcal{M}}` containing a monomial `M` such that `e_iM = 0`, 

for all `i \in I`, is crystal isomorphic to the irreducible highest weight 

crystal `B(\mathrm{wt}(M))`. 

 

INPUT: 

 

- ``ct`` -- a Cartan type 

 

- ``La`` -- an element of the weight lattice 

 

EXAMPLES:: 

 

sage: La = RootSystem("A2").weight_lattice().fundamental_weights() 

sage: M = crystals.NakajimaMonomials("A2",La[1]+La[2]) 

sage: B = crystals.Tableaux("A2",shape=[2,1]) 

sage: GM = M.digraph() 

sage: GB = B.digraph() 

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

True 

 

sage: La = RootSystem("G2").weight_lattice().fundamental_weights() 

sage: M = crystals.NakajimaMonomials("G2",La[1]+La[2]) 

sage: B = crystals.Tableaux("G2",shape=[2,1]) 

sage: GM = M.digraph() 

sage: GB = B.digraph() 

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

True 

 

sage: La = RootSystem("B2").weight_lattice().fundamental_weights() 

sage: M = crystals.NakajimaMonomials(['B',2],La[1]+La[2]) 

sage: B = crystals.Tableaux("B2",shape=[3/2,1/2]) 

sage: GM = M.digraph() 

sage: GB = B.digraph() 

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

True 

 

sage: La = RootSystem(['A',3,1]).weight_lattice(extended=True).fundamental_weights() 

sage: M = crystals.NakajimaMonomials(['A',3,1],La[0]+La[2]) 

sage: B = crystals.GeneralizedYoungWalls(3,La[0]+La[2]) 

sage: SM = M.subcrystal(max_depth=4) 

sage: SB = B.subcrystal(max_depth=4) 

sage: GM = M.digraph(subset=SM) # long time 

sage: GB = B.digraph(subset=SB) # long time 

sage: GM.is_isomorphic(GB,edge_labels=True) # long time 

True 

 

sage: La = RootSystem(['A',5,2]).weight_lattice(extended=True).fundamental_weights() 

sage: LA = RootSystem(['A',5,2]).weight_space().fundamental_weights() 

sage: M = crystals.NakajimaMonomials(['A',5,2],3*La[0]) 

sage: B = crystals.LSPaths(3*LA[0]) 

sage: SM = M.subcrystal(max_depth=4) 

sage: SB = B.subcrystal(max_depth=4) 

sage: GM = M.digraph(subset=SM) 

sage: GB = B.digraph(subset=SB) 

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

True 

 

sage: c = matrix([[0,1,0],[0,0,1],[1,0,0]]) 

sage: La = RootSystem(['A',2,1]).weight_lattice(extended=True).fundamental_weights() 

sage: M = crystals.NakajimaMonomials(2*La[1], c=c) 

sage: list(M.subcrystal(max_depth=3)) 

[Y(1,0)^2, 

Y(0,1) Y(1,0) Y(1,1)^-1 Y(2,0), 

Y(0,2)^-1 Y(1,0) Y(2,0) Y(2,2), 

Y(0,1)^2 Y(1,1)^-2 Y(2,0)^2, 

Y(0,0) Y(0,1) Y(1,0) Y(2,1)^-1, 

Y(0,0) Y(0,2)^-1 Y(1,0) Y(1,1) Y(2,1)^-1 Y(2,2), 

Y(0,1) Y(0,2)^-1 Y(1,1)^-1 Y(2,0)^2 Y(2,2), 

Y(0,0) Y(0,1)^2 Y(1,1)^-1 Y(2,0) Y(2,1)^-1, 

Y(1,0) Y(1,3) Y(2,0) Y(2,3)^-1] 

""" 

@staticmethod 

def __classcall_private__(cls, cartan_type, La=None, c=None): 

r""" 

Normalize input to ensure a unique representation. 

 

EXAMPLES:: 

 

sage: La = RootSystem(['E',8,1]).weight_lattice(extended=True).fundamental_weights() 

sage: M = crystals.NakajimaMonomials(['E',8,1],La[0]+La[8]) 

sage: M1 = crystals.NakajimaMonomials(CartanType(['E',8,1]),La[0]+La[8]) 

sage: M2 = crystals.NakajimaMonomials(['E',8,1],M.Lambda()[0] + M.Lambda()[8]) 

sage: M is M1 is M2 

True 

""" 

if La is None: 

La = cartan_type 

cartan_type = La.parent().cartan_type() 

cartan_type = CartanType(cartan_type) 

if cartan_type.is_affine(): 

La = RootSystem(cartan_type).weight_lattice(extended=True)(La) 

else: 

La = RootSystem(cartan_type).weight_lattice()(La) 

n = len(cartan_type.index_set()) 

c = InfinityCrystalOfNakajimaMonomials._normalize_c(c, n) 

return super(CrystalOfNakajimaMonomials, cls).__classcall__(cls, cartan_type, La, c) 

 

def __init__(self, ct, La, c): 

r""" 

EXAMPLES:: 

 

sage: La = RootSystem(['A',2]).weight_lattice().fundamental_weights() 

sage: M = crystals.NakajimaMonomials(['A',2], La[1]+La[2]) 

sage: TestSuite(M).run() 

 

sage: La = RootSystem(['C',2,1]).weight_lattice(extended=True).fundamental_weights() 

sage: M = crystals.NakajimaMonomials(['C',2,1], La[0]) 

sage: TestSuite(M).run(max_runs=100) 

""" 

if ct.is_finite(): 

cat = ClassicalCrystals() 

else: 

cat = (RegularCrystals(), HighestWeightCrystals(), InfiniteEnumeratedSets()) 

InfinityCrystalOfNakajimaMonomials.__init__(self, ct, c, cat) 

self._cartan_type = ct 

self.hw = La 

gen = {(i,0): c for i,c in La} 

self.module_generators = (self.element_class(self, gen, {}),) 

 

def _repr_(self): 

r""" 

Return a string representation of ``self``. 

 

EXAMPLES:: 

 

sage: La = RootSystem(['C',3,1]).weight_lattice(extended=True).fundamental_weights() 

sage: M = crystals.NakajimaMonomials(['C',3,1],La[0]+5*La[3]) 

sage: M 

Highest weight crystal of modified Nakajima monomials of Cartan type ['C', 3, 1] and highest weight Lambda[0] + 5*Lambda[3] 

""" 

return "Highest weight crystal of modified Nakajima monomials of Cartan type {1!s} and highest weight {0!s}".format(self.hw, self._cartan_type) 

 

def cardinality(self): 

r""" 

Return the cardinality of ``self``. 

 

EXAMPLES:: 

 

sage: La = RootSystem(['A',2]).weight_lattice().fundamental_weights() 

sage: M = crystals.NakajimaMonomials(['A',2], La[1]) 

sage: M.cardinality() 

3 

 

sage: La = RootSystem(['D',4,2]).weight_lattice(extended=True).fundamental_weights() 

sage: M = crystals.NakajimaMonomials(['D',4,2], La[1]) 

sage: M.cardinality() 

+Infinity 

""" 

if not self.cartan_type().is_finite(): 

return Infinity 

return super(InfinityCrystalOfNakajimaMonomials, self).cardinality() 

 

Element = CrystalOfNakajimaMonomialsElement