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

r""" 

Posets 

""" 

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

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

# 

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

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

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

 

from sage.misc.cachefunc import cached_method 

from sage.misc.abstract_method import abstract_method 

from sage.misc.lazy_import import LazyImport 

from sage.categories.category import Category 

from sage.categories.sets_cat import Sets 

 

class Posets(Category): 

r""" 

The category of posets i.e. sets with a partial order structure. 

 

EXAMPLES:: 

 

sage: Posets() 

Category of posets 

sage: Posets().super_categories() 

[Category of sets] 

sage: P = Posets().example(); P 

An example of a poset: sets ordered by inclusion 

 

The partial order is implemented by the mandatory method 

:meth:`~posets.ParentMethods.le`:: 

 

sage: x = P(Set([1,3])); y = P(Set([1,2,3])) 

sage: x, y 

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

sage: P.le(x, y) 

True 

sage: P.le(x, x) 

True 

sage: P.le(y, x) 

False 

 

The other comparison methods are called 

:meth:`~posets.ParentMethods.lt`, :meth:`~posets.ParentMethods.ge`, 

:meth:`~posets.ParentMethods.gt`, following Python's naming 

convention in :mod:`operator`. Default implementations are 

provided:: 

 

sage: P.lt(x, x) 

False 

sage: P.ge(y, x) 

True 

 

Unless the poset is a facade (see :class:`Sets.Facade`), one can 

compare directly its elements using the usual Python operators:: 

 

sage: D = Poset((divisors(30), attrcall("divides")), facade = False) 

sage: D(3) <= D(6) 

True 

sage: D(3) <= D(3) 

True 

sage: D(3) <= D(5) 

False 

sage: D(3) < D(3) 

False 

sage: D(10) >= D(5) 

True 

 

At this point, this has to be implemented by hand. Once 

:trac:`10130` will be resolved, this will be automatically 

provided by this category:: 

 

sage: x < y # todo: not implemented 

True 

sage: x < x # todo: not implemented 

False 

sage: x <= x # todo: not implemented 

True 

sage: y >= x # todo: not implemented 

True 

 

.. SEEALSO:: :func:`Poset`, :class:`FinitePosets`, :class:`LatticePosets` 

 

TESTS:: 

 

sage: C = Posets() 

sage: TestSuite(C).run() 

 

""" 

@cached_method 

def super_categories(self): 

r""" 

Return a list of the (immediate) super categories of 

``self``, as per :meth:`Category.super_categories`. 

 

EXAMPLES:: 

 

sage: Posets().super_categories() 

[Category of sets] 

""" 

return [Sets()] 

 

def example(self, choice = None): 

r""" 

Return examples of objects of ``Posets()``, as per 

:meth:`Category.example() 

<sage.categories.category.Category.example>`. 

 

EXAMPLES:: 

 

sage: Posets().example() 

An example of a poset: sets ordered by inclusion 

 

sage: Posets().example("facade") 

An example of a facade poset: the positive integers ordered by divisibility 

""" 

from sage.categories.examples.posets import FiniteSetsOrderedByInclusion, PositiveIntegersOrderedByDivisibilityFacade 

if choice == "facade": 

return PositiveIntegersOrderedByDivisibilityFacade() 

else: 

return FiniteSetsOrderedByInclusion() 

 

def __iter__(self): 

r""" 

Iterator over representatives of the isomorphism classes of 

posets with finitely many vertices. 

 

.. warning:: this feature may become deprecated, since it does 

of course not iterate through all posets. 

 

EXAMPLES:: 

 

sage: P = Posets() 

sage: it = iter(P) 

sage: for _ in range(10): print(next(it)) 

Finite poset containing 0 elements 

Finite poset containing 1 elements 

Finite poset containing 2 elements 

Finite poset containing 2 elements 

Finite poset containing 3 elements 

Finite poset containing 3 elements 

Finite poset containing 3 elements 

Finite poset containing 3 elements 

Finite poset containing 3 elements 

Finite poset containing 4 elements 

""" 

from sage.combinat.posets.posets import FinitePosets_n 

n = 0 

while True: 

for P in FinitePosets_n(n): 

yield P 

n += 1 

 

Finite = LazyImport('sage.categories.finite_posets', 'FinitePosets') 

 

class ParentMethods: 

 

@abstract_method 

def le(self, x, y): 

r""" 

Return whether `x \le y` in the poset ``self``. 

 

INPUT: 

 

- ``x``, ``y`` -- elements of ``self``. 

 

EXAMPLES:: 

 

sage: D = Poset((divisors(30), attrcall("divides"))) 

sage: D.le( 3, 6 ) 

True 

sage: D.le( 3, 3 ) 

True 

sage: D.le( 3, 5 ) 

False 

""" 

 

def lt(self, x, y): 

r""" 

Return whether `x < y` in the poset ``self``. 

 

INPUT: 

 

- ``x``, ``y`` -- elements of ``self``. 

 

This default implementation delegates the work to :meth:`le`. 

 

EXAMPLES:: 

 

sage: D = Poset((divisors(30), attrcall("divides"))) 

sage: D.lt( 3, 6 ) 

True 

sage: D.lt( 3, 3 ) 

False 

sage: D.lt( 3, 5 ) 

False 

""" 

return self.le(x,y) and x != y 

 

def ge(self, x, y): 

r""" 

Return whether `x \ge y` in the poset ``self``. 

 

INPUT: 

 

- ``x``, ``y`` -- elements of ``self``. 

 

This default implementation delegates the work to :meth:`le`. 

 

EXAMPLES:: 

 

sage: D = Poset((divisors(30), attrcall("divides"))) 

sage: D.ge( 6, 3 ) 

True 

sage: D.ge( 3, 3 ) 

True 

sage: D.ge( 3, 5 ) 

False 

""" 

return self.le(y,x) 

 

def gt(self, x, y): 

r""" 

Return whether `x > y` in the poset ``self``. 

 

INPUT: 

 

- ``x``, ``y`` -- elements of ``self``. 

 

This default implementation delegates the work to :meth:`lt`. 

 

EXAMPLES:: 

 

sage: D = Poset((divisors(30), attrcall("divides"))) 

sage: D.gt( 3, 6 ) 

False 

sage: D.gt( 3, 3 ) 

False 

sage: D.gt( 3, 5 ) 

False 

""" 

return self.lt(y,x) 

 

@abstract_method(optional = True) 

def upper_covers(self, x): 

r""" 

Return the upper covers of `x`, that is, the elements `y` 

such that `x<y` and there exists no `z` such that `x<z<y`. 

 

EXAMPLES:: 

 

sage: D = Poset((divisors(30), attrcall("divides"))) 

sage: D.upper_covers(3) 

[6, 15] 

""" 

 

@abstract_method(optional = True) 

def lower_covers(self, x): 

r""" 

Return the lower covers of `x`, that is, the elements `y` 

such that `y<x` and there exists no `z` such that `y<z<x`. 

 

EXAMPLES:: 

 

sage: D = Poset((divisors(30), attrcall("divides"))) 

sage: D.lower_covers(15) 

[3, 5] 

""" 

 

@abstract_method(optional = True) 

def order_ideal(self, elements): 

r""" 

Return the order ideal in ``self`` generated by the elements 

of an iterable ``elements``. 

 

A subset `I` of a poset is said to be an order ideal if, for 

any `x` in `I` and `y` such that `y \le x`, then `y` is in `I`. 

 

This is also called the lower set generated by these elements. 

 

EXAMPLES:: 

 

sage: B = posets.BooleanLattice(4) 

sage: B.order_ideal([7,10]) 

[0, 1, 2, 3, 4, 5, 6, 7, 8, 10] 

""" 

 

@abstract_method(optional = True) 

def order_filter(self, elements): 

r""" 

Return the order filter generated by a list of elements. 

 

A subset `I` of a poset is said to be an order filter if, for 

any `x` in `I` and `y` such that `y \ge x`, then `y` is in `I`. 

 

This is also called the upper set generated by these elements. 

 

EXAMPLES:: 

 

sage: B = posets.BooleanLattice(4) 

sage: B.order_filter([3,8]) 

[3, 7, 8, 9, 10, 11, 12, 13, 14, 15] 

""" 

 

def directed_subset(self, elements, direction): 

r""" 

Return the order filter or the order ideal generated by a 

list of elements. 

 

If ``direction`` is 'up', the order filter (upper set) is 

being returned. 

 

If ``direction`` is 'down', the order ideal (lower set) is 

being returned. 

 

INPUT: 

 

- elements -- a list of elements. 

 

- direction -- 'up' or 'down'. 

 

EXAMPLES:: 

 

sage: B = posets.BooleanLattice(4) 

sage: B.directed_subset([3, 8], 'up') 

[3, 7, 8, 9, 10, 11, 12, 13, 14, 15] 

sage: B.directed_subset([7, 10], 'down') 

[0, 1, 2, 3, 4, 5, 6, 7, 8, 10] 

""" 

if direction == 'up': 

return self.order_filter(elements) 

if direction == 'down': 

return self.order_ideal(elements) 

raise ValueError("Direction must be either 'up' or 'down'.") 

 

def principal_order_ideal(self, x): 

r""" 

Return the order ideal generated by an element ``x``. 

 

This is also called the lower set generated by this element. 

 

EXAMPLES:: 

 

sage: B = posets.BooleanLattice(4) 

sage: B.principal_order_ideal(6) 

[0, 2, 4, 6] 

""" 

return self.order_ideal([x]) 

 

principal_lower_set = principal_order_ideal 

 

def principal_order_filter(self, x): 

r""" 

Return the order filter generated by an element ``x``. 

 

This is also called the upper set generated by this element. 

 

EXAMPLES:: 

 

sage: B = posets.BooleanLattice(4) 

sage: B.principal_order_filter(2) 

[2, 3, 6, 7, 10, 11, 14, 15] 

""" 

return self.order_filter([x]) 

 

principal_upper_set = principal_order_filter 

 

def order_ideal_toggle(self, I, v): 

r""" 

Return the result of toggling the element ``v`` in the 

order ideal ``I``. 

 

If `v` is an element of a poset `P`, then toggling the 

element `v` is an automorphism of the set `J(P)` of all 

order ideals of `P`. It is defined as follows: If `I` 

is an order ideal of `P`, then the image of `I` under 

toggling the element `v` is 

 

- the set `I \cup \{ v \}`, if `v \not\in I` but 

every element of `P` smaller than `v` is in `I`; 

 

- the set `I \setminus \{ v \}`, if `v \in I` but 

no element of `P` greater than `v` is in `I`; 

 

- `I` otherwise. 

 

This image always is an order ideal of `P`. 

 

EXAMPLES:: 

 

sage: P = Poset({1: [2,3], 2: [4], 3: []}) 

sage: I = Set({1, 2}) 

sage: I in P.order_ideals_lattice() 

True 

sage: P.order_ideal_toggle(I, 1) 

{1, 2} 

sage: P.order_ideal_toggle(I, 2) 

{1} 

sage: P.order_ideal_toggle(I, 3) 

{1, 2, 3} 

sage: P.order_ideal_toggle(I, 4) 

{1, 2, 4} 

sage: P4 = Posets(4) 

sage: all(all(all(P.order_ideal_toggle(P.order_ideal_toggle(I, i), i) == I 

....: for i in range(4)) 

....: for I in P.order_ideals_lattice(facade=True)) 

....: for P in P4) 

True 

""" 

if not v in I: 

if all(u in I for u in self.lower_covers(v)): 

from sage.sets.set import Set 

return I.union(Set({v})) 

else: 

if all(u not in I for u in self.upper_covers(v)): 

from sage.sets.set import Set 

return I.difference(Set({v})) 

return I 

 

def order_ideal_toggles(self, I, vs): 

r""" 

Return the result of toggling the elements of the list (or 

iterable) ``vs`` (one by one, from left to right) in the order 

ideal ``I``. 

 

See :meth:`order_ideal_toggle` for a definition of toggling. 

 

EXAMPLES:: 

 

sage: P = Poset({1: [2,3], 2: [4], 3: []}) 

sage: I = Set({1, 2}) 

sage: P.order_ideal_toggles(I, [1,2,3,4]) 

{1, 3} 

sage: P.order_ideal_toggles(I, (1,2,3,4)) 

{1, 3} 

""" 

for v in vs: 

I = self.order_ideal_toggle(I, v) 

return I 

 

def is_order_ideal(self, o): 

""" 

Return whether ``o`` is an order ideal of ``self``, assuming ``self`` 

has no infinite descending path. 

 

INPUT: 

 

- ``o`` -- a list (or set, or tuple) containing some elements of ``self`` 

 

EXAMPLES:: 

 

sage: P = Poset((divisors(12), attrcall("divides")), facade=True, linear_extension=True) 

sage: sorted(P.list()) 

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

sage: P.is_order_ideal([1, 3]) 

True 

sage: P.is_order_ideal([]) 

True 

sage: P.is_order_ideal({1, 3}) 

True 

sage: P.is_order_ideal([1, 3, 4]) 

False 

 

""" 

return all((u in self and all(x in o for x in self.lower_covers(u))) for u in o) 

 

def is_order_filter(self, o): 

""" 

Return whether ``o`` is an order filter of ``self``, assuming ``self`` 

has no infinite ascending path. 

 

INPUT: 

 

- ``o`` -- a list (or set, or tuple) containing some elements of ``self`` 

 

EXAMPLES:: 

 

sage: P = Poset((divisors(12), attrcall("divides")), facade=True, linear_extension=True) 

sage: sorted(P.list()) 

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

sage: P.is_order_filter([4, 12]) 

True 

sage: P.is_order_filter([]) 

True 

sage: P.is_order_filter({3, 4, 12}) 

False 

sage: P.is_order_filter({3, 6, 12}) 

True 

 

""" 

return all((u in self and all(x in o for x in self.upper_covers(u))) for u in o) 

 

def is_chain_of_poset(self, o, ordered=False): 

""" 

Return whether an iterable ``o`` is a chain of ``self``, 

including a check for ``o`` being ordered from smallest 

to largest element if the keyword ``ordered`` is set to 

``True``. 

 

INPUT: 

 

- ``o`` -- an iterable (e. g., list, set, or tuple) 

containing some elements of ``self`` 

 

- ``ordered`` -- a Boolean (default: ``False``) which 

decides whether the notion of a chain includes being 

ordered 

 

OUTPUT: 

 

If ``ordered`` is set to ``False``, the truth value of 

the following assertion is returned: The subset of ``self`` 

formed by the elements of ``o`` is a chain in ``self``. 

 

If ``ordered`` is set to ``True``, the truth value of 

the following assertion is returned: Every element of the 

list ``o`` is (strictly!) smaller than its successor in 

``self``. (This makes no sense if ``ordered`` is a set.) 

 

EXAMPLES:: 

 

sage: P = Poset((divisors(12), attrcall("divides")), facade=True, linear_extension=True) 

sage: sorted(P.list()) 

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

sage: P.is_chain_of_poset([1, 3]) 

True 

sage: P.is_chain_of_poset([3, 1]) 

True 

sage: P.is_chain_of_poset([1, 3], ordered=True) 

True 

sage: P.is_chain_of_poset([3, 1], ordered=True) 

False 

sage: P.is_chain_of_poset([]) 

True 

sage: P.is_chain_of_poset([], ordered=True) 

True 

sage: P.is_chain_of_poset((2, 12, 6)) 

True 

sage: P.is_chain_of_poset((2, 6, 12), ordered=True) 

True 

sage: P.is_chain_of_poset((2, 12, 6), ordered=True) 

False 

sage: P.is_chain_of_poset((2, 12, 6, 3)) 

False 

sage: P.is_chain_of_poset((2, 3)) 

False 

 

sage: Q = Poset({2: [3, 1], 3: [4], 1: [4]}) 

sage: Q.is_chain_of_poset([1, 2], ordered=True) 

False 

sage: Q.is_chain_of_poset([1, 2]) 

True 

sage: Q.is_chain_of_poset([2, 1], ordered=True) 

True 

sage: Q.is_chain_of_poset([2, 1, 1], ordered=True) 

False 

sage: Q.is_chain_of_poset([3]) 

True 

sage: Q.is_chain_of_poset([4, 2, 3]) 

True 

sage: Q.is_chain_of_poset([4, 2, 3], ordered=True) 

False 

sage: Q.is_chain_of_poset([2, 3, 4], ordered=True) 

True 

 

Examples with infinite posets:: 

 

sage: from sage.categories.examples.posets import FiniteSetsOrderedByInclusion 

sage: R = FiniteSetsOrderedByInclusion() 

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

False 

sage: R.is_chain_of_poset([R(set([3, 1, 2])), R(set([1, 2])), R(set([1]))], ordered=True) 

False 

sage: R.is_chain_of_poset([R(set([3, 1, 2])), R(set([1, 2])), R(set([1]))]) 

True 

 

sage: from sage.categories.examples.posets import PositiveIntegersOrderedByDivisibilityFacade 

sage: T = PositiveIntegersOrderedByDivisibilityFacade() 

sage: T.is_chain_of_poset((T(3), T(4), T(7))) 

False 

sage: T.is_chain_of_poset((T(3), T(6), T(3))) 

True 

sage: T.is_chain_of_poset((T(3), T(6), T(3)), ordered=True) 

False 

sage: T.is_chain_of_poset((T(3), T(3), T(6))) 

True 

sage: T.is_chain_of_poset((T(3), T(3), T(6)), ordered=True) 

False 

sage: T.is_chain_of_poset((T(3), T(6)), ordered=True) 

True 

sage: T.is_chain_of_poset((), ordered=True) 

True 

sage: T.is_chain_of_poset((T(3),), ordered=True) 

True 

sage: T.is_chain_of_poset((T(q) for q in divisors(27))) 

True 

sage: T.is_chain_of_poset((T(q) for q in divisors(18))) 

False 

""" 

list_o = list(o) 

if ordered: 

return all(self.lt(a, b) for a, b in zip(list_o, list_o[1:])) 

else: 

for (i, x) in enumerate(list_o): 

for y in list_o[:i]: 

if (not self.le(x, y)) and (not self.gt(x, y)): 

return False 

return True 

 

def is_antichain_of_poset(self, o): 

""" 

Return whether an iterable ``o`` is an antichain of 

``self``. 

 

INPUT: 

 

- ``o`` -- an iterable (e. g., list, set, or tuple) 

containing some elements of ``self`` 

 

OUTPUT: 

 

``True`` if the subset of ``self`` consisting of the entries 

of ``o`` is an antichain of ``self``, and ``False`` otherwise. 

 

EXAMPLES:: 

 

sage: P = Poset((divisors(12), attrcall("divides")), facade=True, linear_extension=True) 

sage: sorted(P.list()) 

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

sage: P.is_antichain_of_poset([1, 3]) 

False 

sage: P.is_antichain_of_poset([3, 1]) 

False 

sage: P.is_antichain_of_poset([1, 1, 3]) 

False 

sage: P.is_antichain_of_poset([]) 

True 

sage: P.is_antichain_of_poset([1]) 

True 

sage: P.is_antichain_of_poset([1, 1]) 

True 

sage: P.is_antichain_of_poset([3, 4]) 

True 

sage: P.is_antichain_of_poset([3, 4, 12]) 

False 

sage: P.is_antichain_of_poset([6, 4]) 

True 

sage: P.is_antichain_of_poset(i for i in divisors(12) if (2 < i and i < 6)) 

True 

sage: P.is_antichain_of_poset(i for i in divisors(12) if (2 <= i and i < 6)) 

False 

 

sage: Q = Poset({2: [3, 1], 3: [4], 1: [4]}) 

sage: Q.is_antichain_of_poset((1, 2)) 

False 

sage: Q.is_antichain_of_poset((2, 4)) 

False 

sage: Q.is_antichain_of_poset((4, 2)) 

False 

sage: Q.is_antichain_of_poset((2, 2)) 

True 

sage: Q.is_antichain_of_poset((3, 4)) 

False 

sage: Q.is_antichain_of_poset((3, 1)) 

True 

sage: Q.is_antichain_of_poset((1, )) 

True 

sage: Q.is_antichain_of_poset(()) 

True 

 

An infinite poset:: 

 

sage: from sage.categories.examples.posets import FiniteSetsOrderedByInclusion 

sage: R = FiniteSetsOrderedByInclusion() 

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

True 

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

False 

""" 

return all(not self.lt(x,y) for x in o for y in o) 

 

CartesianProduct = LazyImport( 

'sage.combinat.posets.cartesian_product', 'CartesianProductPoset') 

 

class ElementMethods: 

pass 

# TODO: implement x<y, x<=y, x>y, x>=y appropriately once #10130 is resolved 

# 

# def __le__(self, other): 

# r""" 

# Return whether ``self`` is smaller or equal to ``other`` 

# in the poset. 

# 

# EXAMPLES:: 

# 

# sage: P = Posets().example(); P 

# An example of poset: sets ordered by inclusion 

# sage: x = P(Set([1,3])); y = P(Set([1,2,3])) 

# sage: x.__le__(y) 

# sage: x <= y 

# """ 

# return self.parent().le(self, other)