Zulip Chat Archive

Stream: general

Topic: Stars and bars revisited


Eric Wieser (Mar 30 2022 at 09:23):

In #11162, we have a PR that claims to "prove" stars and bars.

However, I'd argue that "stars and bars" is really a tool for solving combinatorics problems, not a specific problem, which goes roughly as:

  • Translate your problem into an analogous problem about stars and bars (by constructing an explicit isomorphism between your problem state, and a stars and bars type
  • Solve the stars and bars problem

Do we want a stars_and_bars type?

Eric Wieser (Mar 30 2022 at 09:24):

Here's what such a type could look like:

Eric Wieser (Mar 30 2022 at 12:35):

PR'd as #13063

Yaël Dillies (Mar 30 2022 at 12:35):

What does it buy us exactly?

Eric Wieser (Mar 30 2022 at 12:48):

My hope was that translating to and from stars_and_bars would be a bit easier than it turned out to be

Eric Wieser (Mar 30 2022 at 12:49):

Unfortunately the equation compiler doesn't produce nice equation lemmas for this type

Eric Wieser (Mar 30 2022 at 12:50):

The main motivation was that it allows to you write "I'm going to argue this by stars and bars" in the lean code itself

Julian Berman (Mar 30 2022 at 14:50):

Imprecise question I'm sure, but if I can ask it anyhow, is a reasonable "generalization" of representing stars and bars finding a way to represent all of the twelvefold way (or the even-more-number-way-generalizations) of which stars and bars is one case? Or are all of those going to be vastly different anyhow?

Kyle Miller (Mar 30 2022 at 15:41):

@Julian Berman Just want to mention that the main result in the PR is to show that card (sym α k) = (card α + k - 1).choose k, which basically fits into the twelvefold way since sym α k may be regarded as the type of functions fin k -> α modulo permutations of the domain. There are lots of ways to represent functions between finite types, so whether this counts is subjective. (It would probably be nice to have a "direct" formalization of the twelvefold way, too.)

Kyle Miller (Mar 30 2022 at 15:45):

@Eric Wieser I'd like to see something like your variant of stars and bars, since that's the one I'm familiar with, and I agree that it could be useful to solve combinatorics problems. I don't think we should replace #11162 with it, though, since that one is (more or less) giving the cardinality of one of of the cases of the twelvefold way.

Eric Wieser (Mar 30 2022 at 15:57):

I definitely wasn't suggesting losing the results in #11162, just maybe actually using stars and bars in the proof somehow

Eric Wieser (Mar 30 2022 at 16:01):

I had a go at adding the additional result that actually motivated this thread in branch#eric-wieser/stars-and-bars-dependent-hell, that stars_and_bars s b ≃ {f : fin b.succ → ℕ // ∑ i, f i = s}. As the name of the branch suggest, I was not able to show the equivalence

Kyle Miller (Mar 30 2022 at 16:04):

Could you instead try showing it's equivalent to sym (fin b.succ) s? That's defined to be {m : multiset (fin b.succ) // m.card = s}.

Kyle Miller (Mar 30 2022 at 16:05):

I'm not sure if that's easier, but then what happens is #11162 would give you the cardinality of stars_and_bars.

Eric Wieser (Mar 30 2022 at 16:08):

The cardinality of stars_and_barsis already in the PR


Last updated: Dec 20 2023 at 11:08 UTC