Skip to content

Set factories #10194

@nthiery

Description

@nthiery

At Sage days 30, a long brainstorm seems to have finalized the design. Here is a excerpt from the documentation:

A set factory F is device, whose goal is to construct parent P
which models subsets of a big set S. Typically, the P s are constructed
within families obtained by putting a bunch of constraints cons on the
elements of the set S. In such a hierarchy of subsets, one needs to have a
fine and easy control on the elements construction. That is, one often needs
that P constructs elements in a subclass of its usual class for element. On
the contrary, one also often needs P to be a facade parent, meaning that P
construct element whose actual parent is not P itself.

The role of a set factory is twofold:

  • manage a database of constructors for the different parents P = F(cons)
    depending on the various kinds of constraints cons. Note: currently there
    is no real support for that. We are gathering use case before fixing the
    interface.

  • ensure that the elements e = P(...) created by the different parents
    follows a consistent policy concerning their class and parent.

The patch implement this idea while trying to leave as much as possible space
for further improvement. In particular, I tried to specify the few possible
things about constraints. I'm even not completely sure about add_constraints.
Please comment and review.

Florent

CC: @sagetrac-sage-combinat @hivert

Component: combinatorics

Keywords: factories, days30, Cernay2012, days57

Author: Florent Hivert

Branch/Commit: 763f93c

Reviewer: Frédéric Chapoton

Issue created by migration from https://trac.sagemath.org/ticket/10194

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions