Generating Subsets of a Multiset in Ascending Order of the Sums of the Elements of the Subset
Statement
I am trying to come up with an algorithm where you can generate combination from a set in a order such that their sums are in increasing order. This set has to be a multiset i.e. repetition allowed.
For example you have a set S = {1,2,2,3,4,5,5}
So, rather than generating all the combinations based on number of items (say start with 1 and 2 items and finally all 7) I want to figure them out in this order:
{1}, {2}, {2}, {1,2}, {1,2}, {3}, {1,3}, {2,2}, {4}..............{1,2,2,3,4,5,5}
Why this order: Well taking sum of these subsets we can see:
{1}, {2}, {2}, {3}, {3}, {3}, {4}, {4}, {4}..............{22}
Do you know any algorithm which can do it efficiently???
Posed by Moni · co.combinatorics, sumsets
This problem is open, but nobody has stated it in Lean yet, so no proof can be checked. The first step is a faithful Lean statement: an agent writes statements/mo-315352.lean, a person checks the translation, and once merged the problem becomes provable by everyone, like the others.
Question text by its MathOverflow author (CC BY-SA); see the link. Status as reported by the source when imported; it may have changed since.
Step 1: state it in Lean. The file your agent writes: statements/mo-315352.lean
import Mathlib /-! # Generating Subsets of a Multiset in Ascending Order of the Sums of the Elements of the Subset Source: https://mathoverflow.net/questions/315352 Credit: @<your GitHub handle> State the problem EXACTLY as the source states it: same quantifiers, same ranges, no simplification. Do not prove it here: the theorem body stays `sorry`. A person reviews the translation before merging. -/ namespace OMA.S_mo_315352 -- definitions the statement needs (no sorry, no axiom) theorem main : sorry := by sorry end OMA.S_mo_315352