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

r""" 

Finite Coxeter Groups 

""" 

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

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

# Copyright (C) 2009 Nicolas Borie <nicolas dot borie at math.u-psud.fr> 

# 

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

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

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

 

from sage.misc.cachefunc import cached_method, cached_in_parent_method 

from sage.misc.lazy_attribute import lazy_attribute 

from sage.categories.category_with_axiom import CategoryWithAxiom 

from sage.categories.coxeter_groups import CoxeterGroups 

from sage.rings.all import AA, UniversalCyclotomicField, QQbar, QQ 

from sage.rings.integer_ring import ZZ 

 

class FiniteCoxeterGroups(CategoryWithAxiom): 

r""" 

The category of finite Coxeter groups. 

 

EXAMPLES:: 

 

sage: CoxeterGroups.Finite() 

Category of finite coxeter groups 

sage: FiniteCoxeterGroups().super_categories() 

[Category of finite generalized coxeter groups, 

Category of coxeter groups] 

 

sage: G = CoxeterGroups().Finite().example() 

sage: G.cayley_graph(side = "right").plot() 

Graphics object consisting of 40 graphics primitives 

 

Here are some further examples:: 

 

sage: WeylGroups().Finite().example() 

The symmetric group on {0, ..., 3} 

 

sage: WeylGroup(["B", 3]) 

Weyl Group of type ['B', 3] (as a matrix group acting on the ambient space) 

 

Those other examples will eventually be also in this category:: 

 

sage: SymmetricGroup(4) 

Symmetric group of order 4! as a permutation group 

sage: DihedralGroup(5) 

Dihedral group of order 10 as a permutation group 

""" 

def extra_super_categories(self): 

r""" 

EXAMPLES:: 

 

sage: CoxeterGroups().Finite().super_categories() 

[Category of finite generalized coxeter groups, 

Category of coxeter groups] 

""" 

from sage.categories.complex_reflection_groups import ComplexReflectionGroups 

return [ComplexReflectionGroups().Finite().WellGenerated()] 

 

class ParentMethods: 

""" 

Ambiguity resolution: the implementation of ``some_elements`` 

is preferable to that of :class:`FiniteGroups`. The same holds 

for ``__iter__``, although a breath first search would be more 

natural; at least this maintains backward compatibility after 

:trac:`13589`. 

 

TESTS:: 

 

sage: W = FiniteCoxeterGroups().example(3) 

 

sage: W.some_elements.__module__ 

'sage.categories.complex_reflection_or_generalized_coxeter_groups' 

sage: W.__iter__.__module__ 

'sage.categories.coxeter_groups' 

 

sage: W.some_elements() 

[(1,), (2,), (), (1, 2)] 

sage: list(W) 

[(), (1,), (2,), (1, 2), (2, 1), (1, 2, 1)] 

""" 

__iter__ = CoxeterGroups.ParentMethods.__dict__["__iter__"] 

 

@lazy_attribute 

def w0(self): 

r""" 

Return the longest element of ``self``. 

 

This attribute is deprecated, use :meth:`long_element` instead. 

 

EXAMPLES:: 

 

sage: D8 = FiniteCoxeterGroups().example(8) 

sage: D8.w0 

(1, 2, 1, 2, 1, 2, 1, 2) 

sage: D3 = FiniteCoxeterGroups().example(3) 

sage: D3.w0 

(1, 2, 1) 

""" 

return self.long_element() 

 

def long_element(self, index_set=None, as_word=False): 

r""" 

Return the longest element of ``self``, or of the 

parabolic subgroup corresponding to the given ``index_set``. 

 

INPUT: 

 

- ``index_set`` -- a subset (as a list or iterable) of the 

nodes of the Dynkin diagram; (default: all of them) 

 

- ``as_word`` -- boolean (default ``False``). If ``True``, then 

return instead a reduced decomposition of the longest element. 

 

Should this method be called maximal_element? longest_element? 

 

EXAMPLES:: 

 

sage: D10 = FiniteCoxeterGroups().example(10) 

sage: D10.long_element() 

(1, 2, 1, 2, 1, 2, 1, 2, 1, 2) 

sage: D10.long_element([1]) 

(1,) 

sage: D10.long_element([2]) 

(2,) 

sage: D10.long_element([]) 

() 

 

sage: D7 = FiniteCoxeterGroups().example(7) 

sage: D7.long_element() 

(1, 2, 1, 2, 1, 2, 1) 

 

One can require instead a reduced word for w0:: 

 

sage: A3 = CoxeterGroup(['A', 3]) 

sage: A3.long_element(as_word=True) 

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

""" 

if index_set is None: 

index_set = self.index_set() 

w = self.one() 

if as_word: 

word = [] 

while True: 

i = w.first_descent(index_set=index_set, positive=True) 

if i is None: 

if as_word: 

return word 

else: 

return w 

else: 

if as_word: 

word.append(i) 

w = w.apply_simple_reflection(i) 

 

@cached_method 

def bruhat_poset(self, facade=False): 

""" 

Return the Bruhat poset of ``self``. 

 

.. SEEALSO:: 

 

:meth:`bhz_poset`, :meth:`shard_poset`, :meth:`weak_poset` 

 

EXAMPLES:: 

 

sage: W = WeylGroup(["A", 2]) 

sage: P = W.bruhat_poset() 

sage: P 

Finite poset containing 6 elements 

sage: P.show() 

 

Here are some typical operations on this poset:: 

 

sage: W = WeylGroup(["A", 3]) 

sage: P = W.bruhat_poset() 

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

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

sage: P(u) <= P(v) 

True 

sage: len(P.interval(P(u), P(v))) 

10 

sage: P.is_join_semilattice() 

False 

 

By default, the elements of `P` are aware that they belong 

to `P`:: 

 

sage: P.an_element().parent() 

Finite poset containing 24 elements 

 

If instead one wants the elements to be plain elements of 

the Coxeter group, one can use the ``facade`` option:: 

 

sage: P = W.bruhat_poset(facade = True) 

sage: P.an_element().parent() 

Weyl Group of type ['A', 3] (as a matrix group acting on the ambient space) 

 

.. SEEALSO:: :func:`Poset` for more on posets and facade posets. 

 

TESTS:: 

 

sage: [len(WeylGroup(["A", n]).bruhat_poset().cover_relations()) for n in [1,2,3]] 

[1, 8, 58] 

 

.. todo:: 

 

- Use the symmetric group in the examples (for nicer 

output), and print the edges for a stronger test. 

- The constructed poset should be lazy, in order to 

handle large / infinite Coxeter groups. 

""" 

from sage.combinat.posets.posets import Poset 

covers = tuple([u, v] for v in self for u in v.bruhat_lower_covers() ) 

return Poset((self, covers), cover_relations=True, facade=facade) 

 

def shard_poset(self, side='right'): 

""" 

Return the shard intersection order attached to `W`. 

 

This is a lattice structure on `W`, introduced in [Reading]_. It 

contains the noncrossing partition lattice, as the induced lattice 

on the subset of `c`-sortable elements. 

 

The partial order is given by simultaneous inclusion of inversion sets 

and subgroups attached to every element. 

 

The precise description used here can be found in [StThWi]_. 

 

Another implementation for the symmetric groups is 

available as :func:`~sage.combinat.shard_order.shard_poset`. 

 

.. SEEALSO:: 

 

:meth:`bhz_poset`, :meth:`bruhat_poset`, :meth:`weak_poset` 

 

EXAMPLES:: 

 

sage: W = CoxeterGroup(['A',3], base_ring=ZZ) 

sage: SH = W.shard_poset(); SH 

Finite lattice containing 24 elements 

sage: SH.is_graded() 

True 

sage: SH.characteristic_polynomial() 

q^3 - 11*q^2 + 23*q - 13 

sage: SH.f_polynomial() 

34*q^3 + 22*q^2 + q 

 

REFERENCES: 

 

.. [Reading] Nathan Reading, *Noncrossing partitions and the shard 

intersection order*, DMTCS Proceedings of FPSAC 2009, 745--756 

 

.. [StThWi] Christian Stump, Hugh Thomas and Nathan Williams, 

*Cataland: why the fuss?*, :arxiv:`1503.00710` 

""" 

from sage.combinat.posets.lattices import LatticePoset 

data = {w: (frozenset(u.lift() 

for u in w.covered_reflections_subgroup()), 

frozenset((~w).inversions_as_reflections())) 

for w in self} 

 

def shard_comparison(u, v): 

Gu, Nu = data[u] 

Gv, Nv = data[v] 

return Gu.issubset(Gv) and Nu.issubset(Nv) 

 

return LatticePoset([self, shard_comparison]) 

 

def bhz_poset(self): 

r""" 

Return the Bergeron-Hohlweg-Zabrocki partial order on the Coxeter 

group. 

 

This is a partial order on the elements of a finite 

Coxeter group `W`, which is distinct from the Bruhat 

order, the weak order and the shard intersection order. It 

was defined in [BHZ05]_. 

 

This partial order is not a lattice, as there is no unique 

maximal element. It can be succintly defined as follows. 

 

Let `u` and `v` be two elements of the Coxeter group `W`. Let 

`S(u)` be the support of `u`. Then `u \leq v` if and only 

if `v_{S(u)} = u` (here `v = v^I v_I` denotes the usual 

parabolic decomposition with respect to the standard parabolic 

subgroup `W_I`). 

 

.. SEEALSO:: 

 

:meth:`bruhat_poset`, :meth:`shard_poset`, :meth:`weak_poset` 

 

EXAMPLES:: 

 

sage: W = CoxeterGroup(['A',3], base_ring=ZZ) 

sage: P = W.bhz_poset(); P 

Finite poset containing 24 elements 

sage: P.relations_number() 

103 

sage: P.chain_polynomial() 

34*q^4 + 90*q^3 + 79*q^2 + 24*q + 1 

sage: len(P.maximal_elements()) 

13 

 

REFERENCE: 

 

.. [BHZ05] \N. Bergeron, C. Hohlweg, and M. Zabrocki, *Posets 

related to the Connectivity Set of Coxeter Groups*. 

:arxiv:`math/0509271v3` 

""" 

from sage.graphs.digraph import DiGraph 

from sage.combinat.posets.posets import Poset 

 

def covered_by(ux, vy): 

u, iu, Su = ux 

v, iv, Sv = vy 

if len(Sv) != len(Su) + 1: 

return False 

if not all(u in Sv for u in Su): 

return False 

return all((v * iu).has_descent(x, positive=True) for x in Su) 

 

vertices = [(u, u.inverse(), 

tuple(set(u.reduced_word_reverse_iterator()))) 

for u in self] 

dg = DiGraph([vertices, covered_by]) 

dg.relabel(lambda x: x[0]) 

return Poset(dg, cover_relations=True) 

 

def degrees(self): 

""" 

Return the degrees of the Coxeter group. 

 

The output is an increasing list of integers. 

 

EXAMPLES:: 

 

sage: CoxeterGroup(['A', 4]).degrees() 

(2, 3, 4, 5) 

sage: CoxeterGroup(['B', 4]).degrees() 

(2, 4, 6, 8) 

sage: CoxeterGroup(['D', 4]).degrees() 

(2, 4, 4, 6) 

sage: CoxeterGroup(['F', 4]).degrees() 

(2, 6, 8, 12) 

sage: CoxeterGroup(['E', 8]).degrees() 

(2, 8, 12, 14, 18, 20, 24, 30) 

sage: CoxeterGroup(['H', 3]).degrees() 

(2, 6, 10) 

 

sage: WeylGroup([["A",3], ["A",3], ["B",2]]).degrees() 

(2, 3, 4, 2, 3, 4, 2, 4) 

 

TESTS:: 

 

sage: CoxeterGroup(['A', 4]).degrees() 

(2, 3, 4, 5) 

sage: SymmetricGroup(3).degrees() 

(2, 3) 

""" 

from sage.rings.qqbar import QQbar 

from sage.rings.integer_ring import ZZ 

def degrees_of_irreducible_component(I): 

"""Return the degrees for the irreducible component indexed by I""" 

# A Coxeter element 

s = self.simple_reflections() 

c = self.prod(s[i] for i in I) 

roots = c.matrix().change_ring(QQbar).charpoly().roots() 

args = [(z.rational_argument(), m) for z, m in roots] 

args = [(z if z >=0 else 1 + z, m) for z, m in args] 

h = max(z.denominator() for z, m in args) 

return tuple(sorted(ZZ(z * h + 1) 

for z, m in args if z 

for i in range(m))) 

 

return sum((degrees_of_irreducible_component(I) 

for I in self.irreducible_component_index_sets()), ()) 

 

def codegrees(self): 

""" 

Return the codegrees of the Coxeter group. 

 

These are just the degrees minus 2. 

 

EXAMPLES:: 

 

sage: CoxeterGroup(['A', 4]).codegrees() 

(0, 1, 2, 3) 

sage: CoxeterGroup(['B', 4]).codegrees() 

(0, 2, 4, 6) 

sage: CoxeterGroup(['D', 4]).codegrees() 

(0, 2, 2, 4) 

sage: CoxeterGroup(['F', 4]).codegrees() 

(0, 4, 6, 10) 

sage: CoxeterGroup(['E', 8]).codegrees() 

(0, 6, 10, 12, 16, 18, 22, 28) 

sage: CoxeterGroup(['H', 3]).codegrees() 

(0, 4, 8) 

 

sage: WeylGroup([["A",3], ["A",3], ["B",2]]).codegrees() 

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

""" 

return tuple(d - 2 for d in self.degrees()) 

 

@cached_method 

def weak_poset(self, side="right", facade=False): 

""" 

INPUT: 

 

- ``side`` -- "left", "right", or "twosided" (default: "right") 

- ``facade`` -- a boolean (default: ``False``) 

 

Returns the left (resp. right) poset for weak order. In 

this poset, `u` is smaller than `v` if some reduced word 

of `u` is a right (resp. left) factor of some reduced word 

of `v`. 

 

.. SEEALSO:: 

 

:meth:`bhz_poset`, :meth:`bruhat_poset`, :meth:`shard_poset` 

 

EXAMPLES:: 

 

sage: W = WeylGroup(["A", 2]) 

sage: P = W.weak_poset() 

sage: P 

Finite lattice containing 6 elements 

sage: P.show() 

 

This poset is in fact a lattice:: 

 

sage: W = WeylGroup(["B", 3]) 

sage: P = W.weak_poset(side = "left") 

sage: P.is_lattice() 

True 

 

so this method has an alias :meth:`weak_lattice`:: 

 

sage: W.weak_lattice(side = "left") is W.weak_poset(side = "left") 

True 

 

As a bonus feature, one can create the left-right weak 

poset:: 

 

sage: W = WeylGroup(["A",2]) 

sage: P = W.weak_poset(side = "twosided") 

sage: P.show() 

sage: len(P.hasse_diagram().edges()) 

8 

 

This is the transitive closure of the union of left and 

right order. In this poset, `u` is smaller than `v` if 

some reduced word of `u` is a factor of some reduced word 

of `v`. Note that this is not a lattice:: 

 

sage: P.is_lattice() 

False 

 

By default, the elements of `P` are aware of that they 

belong to `P`:: 

 

sage: P.an_element().parent() 

Finite poset containing 6 elements 

 

If instead one wants the elements to be plain elements of 

the Coxeter group, one can use the ``facade`` option:: 

 

sage: P = W.weak_poset(facade = True) 

sage: P.an_element().parent() 

Weyl Group of type ['A', 2] (as a matrix group acting on the ambient space) 

 

.. SEEALSO:: :func:`Poset` for more on posets and facade posets. 

 

TESTS:: 

 

sage: [len(WeylGroup(["A", n]).weak_poset(side = "right").cover_relations()) for n in [1,2,3]] 

[1, 6, 36] 

sage: [len(WeylGroup(["A", n]).weak_poset(side = "left" ).cover_relations()) for n in [1,2,3]] 

[1, 6, 36] 

 

.. todo:: 

 

- Use the symmetric group in the examples (for nicer 

output), and print the edges for a stronger test. 

- The constructed poset should be lazy, in order to 

handle large / infinite Coxeter groups. 

""" 

from sage.combinat.posets.posets import Poset 

from sage.combinat.posets.lattices import LatticePoset 

if side == "twosided": 

covers = tuple([u, v] for u in self for v in u.upper_covers(side="left")+u.upper_covers(side="right") ) 

return Poset((self, covers), cover_relations = True, facade = facade) 

else: 

covers = tuple([u, v] for u in self for v in u.upper_covers(side=side) ) 

return LatticePoset((self, covers), cover_relations = True, facade = facade) 

 

weak_lattice = weak_poset 

 

def inversion_sequence(self, word): 

""" 

Return the inversion sequence corresponding to the ``word`` 

in indices of simple generators of ``self``. 

 

If ``word`` corresponds to `[w_0,w_1,...w_k]`, the output is 

`[w_0,w_0w_1w_0,\ldots,w_0w_1\cdots w_k \cdots w_1 w_0]`. 

 

INPUT: 

 

- ``word`` -- a word in the indices of the simple 

generators of ``self``. 

 

EXAMPLES:: 

 

sage: CoxeterGroup(["A", 2]).inversion_sequence([1,2,1]) 

[ 

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

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

] 

 

sage: [t.reduced_word() for t in CoxeterGroup(["A",3]).inversion_sequence([2,1,3,2,1,3])] 

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

 

""" 

return [self.from_reduced_word(word[:i+1]+list(reversed(word[:i]))) 

for i in range(len(word))] 

 

def reflections_from_w0(self): 

""" 

Return the reflections of ``self`` using the inversion set 

of ``w_0``. 

 

EXAMPLES:: 

 

sage: WeylGroup(['A',2]).reflections_from_w0() 

[ 

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

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

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

] 

 

sage: WeylGroup(['A',3]).reflections_from_w0() 

[ 

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

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

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

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

] 

""" 

return self.long_element().inversions_as_reflections() 

 

@cached_method 

def m_cambrian_lattice(self, c, m=1, on_roots=False): 

""" 

Return the `m`-Cambrian lattice on `m`-delta sequences. 

 

See :arxiv:`1503.00710` and :arXiv:`math/0611106`. 

 

The `m`-delta sequences are certain `m`-colored minimal 

factorizations of `c` into reflections. 

 

INPUT: 

 

- `c` -- a Coxeter element of ``self`` (as a tuple, or 

as an element of ``self``) 

 

- `m` -- a positive integer (optional, default 1) 

 

- ``on_roots`` (optional, default ``False``) -- if 

``on_roots`` is ``True``, the lattice is realized on 

roots rather than on reflections. In order for this to 

work, the ElementMethod ``reflection_to_root`` must be 

available. 

 

EXAMPLES:: 

 

sage: CoxeterGroup(["A",2]).m_cambrian_lattice((1,2)) 

Finite lattice containing 5 elements 

 

sage: CoxeterGroup(["A",2]).m_cambrian_lattice((1,2),2) 

Finite lattice containing 12 elements 

""" 

from sage.combinat.posets.lattices import LatticePoset 

if hasattr(c, "reduced_word"): 

c = c.reduced_word() 

c = list(c) 

 

sorting_word = self.long_element().coxeter_sorting_word(c) 

 

if on_roots: 

if not hasattr(self.long_element(), "reflection_to_root"): 

raise ValueError("The parameter 'on_root=True' needs " 

"the ElementMethod 'reflection_to_root'") 

 

inv_woc = [t.reflection_to_root() 

for t in self.inversion_sequence(sorting_word)] 

S = [s.reflection_to_root() for s in self.simple_reflections()] 

PhiP = [t.reflection_to_root() for t in self.reflections()] 

else: 

inv_woc = self.inversion_sequence(sorting_word) 

S = self.simple_reflections() 

T = self.reflections_from_w0() 

Twords = {t : t.reduced_word() for t in T} 

 

elements = set() 

covers = [] 

 

bottom_elt = frozenset((s, 0) for s in S) 

new = set([bottom_elt]) 

while new: 

new_element = new.pop() 

elements.add(new_element) 

for t in new_element: 

if t[1] < m: 

cov_element = [s for s in new_element if s != t] 

cov_element.append((t[0], t[1] + 1)) 

idx_t0 = inv_woc.index(t[0]) 

for t_conj in [(i, t[1]) for i in inv_woc[idx_t0:]] + [(i, t[1] + 1) for i in inv_woc[:idx_t0]]: 

if t_conj in cov_element: 

cov_element.remove(t_conj) 

if on_roots: 

tmp = t_conj[0].weyl_action(t[0].associated_reflection()) 

if tmp in PhiP: 

cov_element.append((tmp, t_conj[1])) 

else: 

cov_element.append((-tmp, t_conj[1] - 1)) 

else: 

tmp = t[0] * t_conj[0] * t[0] 

invs = self.inversion_sequence(Twords[t[0]]+Twords[t_conj[0]]) 

plus_or_minus = invs.count(tmp) 

if plus_or_minus % 2: 

cov_element.append((tmp, t_conj[1])) 

else: 

cov_element.append((tmp, t_conj[1] - 1)) 

 

cov_element = frozenset(cov_element) 

if cov_element not in elements: 

new.add(cov_element) 

covers.append((new_element, cov_element)) 

return LatticePoset([elements, covers], cover_relations=True) 

 

def cambrian_lattice(self, c, on_roots=False): 

""" 

Return the `c`-Cambrian lattice on delta sequences. 

 

See :arxiv:`1503.00710` and :arxiv:`math/0611106`. 

 

Delta sequences are certain 2-colored minimal factorizations 

of ``c`` into reflections. 

 

INPUT: 

 

- ``c`` -- a standard Coxeter element in ``self`` 

(as a tuple, or as an element of ``self``) 

 

- ``on_roots`` (optional, default ``False``) -- if 

``on_roots`` is ``True``, the lattice is realized on 

roots rather than on reflections. In order for this to 

work, the ElementMethod ``reflection_to_root`` must be 

available. 

 

EXAMPLES:: 

 

sage: CoxeterGroup(["A", 2]).cambrian_lattice((1,2)) 

Finite lattice containing 5 elements 

 

sage: CoxeterGroup(["B", 2]).cambrian_lattice((1,2)) 

Finite lattice containing 6 elements 

 

sage: CoxeterGroup(["G", 2]).cambrian_lattice((1,2)) 

Finite lattice containing 8 elements 

""" 

return self.m_cambrian_lattice(c=c, m=1, on_roots=on_roots) 

 

def is_real(self): 

""" 

Return ``True`` since ``self`` is a real reflection group. 

 

EXAMPLES:: 

 

sage: CoxeterGroup(['F',4]).is_real() 

True 

sage: CoxeterGroup(['H',4]).is_real() 

True 

""" 

return True 

 

def permutahedron(self, point=None, base_ring=None): 

r""" 

Return the permutahedron of ``self``, 

 

This is the convex hull of the point ``point`` in the weight 

basis under the action of ``self`` on the underlying vector 

space `V`. 

 

.. SEEALSO:: 

 

:meth:`~sage.combinat.root_system.reflection_group_real.permutahedron` 

 

INPUT: 

 

- ``point`` -- optional, a point given by its coordinates in 

the weight basis (default is `(1, 1, 1, \ldots)`) 

- ``base_ring`` -- optional, the base ring of the polytope 

 

.. NOTE:: 

 

The result is expressed in the root basis coordinates. 

 

.. NOTE:: 

 

If function is too slow, switching the base ring to 

:class:`RDF` will almost certainly speed things up. 

 

EXAMPLES:: 

 

sage: W = CoxeterGroup(['H',3], base_ring=RDF) 

sage: W.permutahedron() 

A 3-dimensional polyhedron in RDF^3 defined as the convex hull of 120 vertices 

 

sage: W = CoxeterGroup(['I',7]) 

sage: W.permutahedron() 

A 2-dimensional polyhedron in AA^2 defined as the convex hull of 14 vertices 

sage: W.permutahedron(base_ring=RDF) 

A 2-dimensional polyhedron in RDF^2 defined as the convex hull of 14 vertices 

 

sage: W = ReflectionGroup(['A',3]) # optional - gap3 

sage: W.permutahedron() # optional - gap3 

A 3-dimensional polyhedron in QQ^3 defined as the convex hull 

of 24 vertices 

 

sage: W = ReflectionGroup(['A',3],['B',2]) # optional - gap3 

sage: W.permutahedron() # optional - gap3 

A 5-dimensional polyhedron in QQ^5 defined as the convex hull of 192 vertices 

 

TESTS:: 

 

sage: W = ReflectionGroup(['A',3]) # optional - gap3 

sage: W.permutahedron([3,5,8]) # optional - gap3 

A 3-dimensional polyhedron in QQ^3 defined as the convex hull 

of 24 vertices 

 

 

.. PLOT:: 

:width: 300 px 

 

W = CoxeterGroup(['I',7]) 

p = W.permutahedron() 

sphinx_plot(p) 

 

""" 

n = self.one().canonical_matrix().rank() 

weights = self.fundamental_weights() 

if point is None: 

point = [ZZ.one()] * n 

v = sum(point[i-1] * weights[i] for i in weights.keys()) 

from sage.geometry.polyhedron.constructor import Polyhedron 

vertices = [v*w for w in self] 

if base_ring is None and v.base_ring() in [UniversalCyclotomicField(), QQbar]: 

vertices = [v.change_ring(AA) for v in vertices] 

base_ring = AA 

return Polyhedron(vertices=vertices, base_ring=base_ring) 

 

class ElementMethods: 

 

@cached_in_parent_method 

def bruhat_upper_covers(self): 

r""" 

Returns all the elements that cover ``self`` in Bruhat order. 

 

EXAMPLES:: 

 

sage: W = WeylGroup(["A",4]) 

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

sage: print([v.reduced_word() for v in w.bruhat_upper_covers()]) 

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

 

sage: W = WeylGroup(["B",6]) 

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

sage: C = w.bruhat_upper_covers() 

sage: len(C) 

9 

sage: print([v.reduced_word() for v in C]) 

[[6, 4, 5, 1, 2, 1], [4, 5, 6, 1, 2, 1], [3, 4, 5, 1, 2, 1], [2, 3, 4, 5, 1, 2], 

[1, 2, 3, 4, 5, 1], [4, 5, 4, 1, 2, 1], [4, 5, 3, 1, 2, 1], [4, 5, 2, 3, 1, 2], 

[4, 5, 1, 2, 3, 1]] 

sage: ww = W.from_reduced_word([5,6,5]) 

sage: CC = ww.bruhat_upper_covers() 

sage: print([v.reduced_word() for v in CC]) 

[[6, 5, 6, 5], [4, 5, 6, 5], [5, 6, 4, 5], [5, 6, 5, 4], [5, 6, 5, 3], [5, 6, 5, 2], 

[5, 6, 5, 1]] 

 

Recursive algorithm: write `w` for ``self``. If `i` is a 

non-descent of `w`, then the covers of `w` are exactly 

`\{ws_i, u_1s_i, u_2s_i,..., u_js_i\}`, where the `u_k` 

are those covers of `ws_i` that have a descent at `i`. 

""" 

 

i = self.first_descent(positive=True) 

if i is not None: 

wsi = self.apply_simple_reflection(i) 

return [u.apply_simple_reflection(i) for u in wsi.bruhat_upper_covers() if u.has_descent(i)] + [wsi] 

else: 

return [] 

 

def coxeter_knuth_neighbor(self, w): 

r""" 

Return the Coxeter-Knuth (oriented) neighbors of the reduced word `w` of ``self``. 

 

INPUT: 

 

- ``w`` -- reduced word of ``self`` 

 

The Coxeter-Knuth relations are given by `a a+1 a \sim a+1 a a+1`, `abc \sim acb` 

if `b<a<c` and `abc \sim bac` if `a<c<b`. This method returns all neighbors of 

``w`` under the Coxeter-Knuth relations oriented from left to right. 

 

EXAMPLES:: 

 

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

sage: word = [1,2,1,3,2] 

sage: w = W.from_reduced_word(word) 

sage: w.coxeter_knuth_neighbor(word) 

{(1, 2, 3, 1, 2), (2, 1, 2, 3, 2)} 

 

sage: word = [1,2,1,3,2,4,3] 

sage: w = W.from_reduced_word(word) 

sage: w.coxeter_knuth_neighbor(word) 

{(1, 2, 1, 3, 4, 2, 3), (1, 2, 3, 1, 2, 4, 3), (2, 1, 2, 3, 2, 4, 3)} 

 

TESTS:: 

 

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

sage: word = [1,2] 

sage: w = W.from_reduced_word(word) 

sage: w.coxeter_knuth_neighbor(word) 

Traceback (most recent call last): 

... 

NotImplementedError: This has only been implemented in finite type A so far! 

""" 

C = self.parent().cartan_type() 

if not C[0] == 'A': 

raise NotImplementedError("This has only been implemented in finite type A so far!") 

d = [] 

for i in range(2,len(w)): 

v = [j for j in w] 

if w[i-2] == w[i]: 

if w[i] == w[i-1] - 1: 

v[i-2] = w[i-1] 

v[i] = w[i-1] 

v[i-1] = w[i] 

d += [tuple(v)] 

elif w[i-1]<w[i-2] and w[i-2]<w[i]: 

v[i] = w[i-1] 

v[i-1] = w[i] 

d += [tuple(v)] 

elif w[i-2]<w[i] and w[i]<w[i-1]: 

v[i-2] = w[i-1] 

v[i-1] = w[i-2] 

d += [tuple(v)] 

return set(d) 

 

def coxeter_knuth_graph(self): 

r""" 

Return the Coxeter-Knuth graph of type `A`. 

 

The Coxeter-Knuth graph of type `A` is generated by the Coxeter-Knuth relations which are 

given by `a a+1 a \sim a+1 a a+1`, `abc \sim acb` if `b<a<c` and `abc \sim bac` if `a<c<b`. 

 

EXAMPLES:: 

 

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

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

sage: D = w.coxeter_knuth_graph() 

sage: D.vertices() 

[(1, 2, 1, 3, 2), 

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

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

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

(2, 3, 1, 2, 3)] 

sage: D.edges() 

[((1, 2, 1, 3, 2), (1, 2, 3, 1, 2), None), 

((1, 2, 1, 3, 2), (2, 1, 2, 3, 2), None), 

((2, 1, 2, 3, 2), (2, 1, 3, 2, 3), None), 

((2, 1, 3, 2, 3), (2, 3, 1, 2, 3), None)] 

 

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

sage: D = w.coxeter_knuth_graph() 

sage: D.vertices() 

[(1, 3), (3, 1)] 

sage: D.edges() 

[] 

 

TESTS:: 

 

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

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

sage: w.coxeter_knuth_graph() 

Traceback (most recent call last): 

... 

NotImplementedError: This has only been implemented in finite type A so far! 

""" 

from sage.graphs.all import Graph 

R = [tuple(v) for v in self.reduced_words()] 

G = Graph() 

G.add_vertices(R) 

G.add_edges([v,vp] for v in R for vp in self.coxeter_knuth_neighbor(v)) 

return G 

 

def is_coxeter_element(self): 

r""" 

Return whether this is a Coxeter element. 

 

This is, whether ``self`` has an eigenvalue `e^{2\pi i/h}` 

where `h` is the Coxeter number. 

 

.. SEEALSO:: :meth:`~sage.categories.finite_complex_reflection_groups.coxeter_elements` 

 

EXAMPLES:: 

 

sage: W = CoxeterGroup(['A',2]) 

sage: c = prod(W.gens()) 

sage: c.is_coxeter_element() 

True 

sage: W.one().is_coxeter_element() 

False 

 

sage: W = WeylGroup(['G', 2]) 

sage: c = prod(W.gens()) 

sage: c.is_coxeter_element() 

True 

sage: W.one().is_coxeter_element() 

False 

""" 

return self in self.parent().coxeter_elements() 

 

def covered_reflections_subgroup(self): 

""" 

Return the subgroup of `W` generated by the conjugates by `w` 

of the simple reflections indexed by right descents of `w`. 

 

This is used to compute the shard intersection order on `W`. 

 

EXAMPLES:: 

 

sage: W = CoxeterGroup(['A',3], base_ring=ZZ) 

sage: len(W.long_element().covered_reflections_subgroup()) 

24 

sage: s = W.simple_reflection(1) 

sage: Gs = s.covered_reflections_subgroup() 

sage: len(Gs) 

2 

sage: s in [u.lift() for u in Gs] 

True 

sage: len(W.one().covered_reflections_subgroup()) 

1 

""" 

W = self.parent() 

winv = ~self 

cov_down = [self * W.simple_reflection(i) * winv 

for i in self.descents(side='right')] 

return W.submonoid(cov_down)