AFTD Auto-Formalizing Theoretical Domains

isFactorizationCoarsening_card_le

theoremverified

A coarsening has at most as many elements as the multiset it coarsens.

Statement

theorem isFactorizationCoarsening_card_le {x y : Multiset ℕ}
    (h : IsFactorizationCoarsening x y) : y.card ≤ x.card
Source
arXiv:2611.18194 (The Möbius function of factorizations with a simple prime factor): sanity lemma for the factorization-poset definitions
Verified
17 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 1
  • IsFactorizationCoarseningA multiset y is a coarsening of a multiset x of positive integers if x can be partitioned into nonempty groups so that y is the multiset…
Used by 1

The proof, explained

By definition, a coarsening $y$ of a multiset $x$ is formed by partitioning $x$ into non-empty blocks $G$ and multiplying each block into a single number. The number of elements in $y$ is the number of blocks $|G|$, while the number of elements in $x$ is the sum of block sizes $\sum_{g \in G} |g|$. Since every block is non-empty, each block has size at least 1, so $|y| = \sum_{g \in G} 1 \le \sum_{g \in G} |g| = |x|$.

  1. There exists a collection $G$ of non-empty multisets partitioning $x$ such that the products of each block form $y$.

    By definition of `IsFactorizationCoarsening x y`, we obtain a multiset of multisets $G$ where every block $g \in G$ is non-empty ($g \ne 0$), the join of all blocks is $x$, and mapping the multiset product over $G$ produces $y$. We substitute $x$ and $y$ with these representations.

    line 3

      obtain ⟨G, hG, rfl, rfl⟩ := h
  2. The inequality $y.\text{card} \le x.\text{card}$ reduces to $|G| \le \sum_{g \in G} |g|$.

    Using `Multiset.card_map`, the cardinality of $y = G.\text{map}(\text{prod})$ is the number of blocks $|G|$. Using `Multiset.card_join`, the cardinality of $x = G.\text{join}$ is the sum of the sizes of the blocks, $\sum_{g \in G} |g|$.

    line 4

    uses Multiset.card_map, Multiset.card_join

      rw [Multiset.card_map, Multiset.card_join]
  3. The number of blocks in $G$ is the sum of 1 over all blocks: $|G| = \sum_{g \in G} 1$.

    Summing the constant 1 over each element of a multiset evaluates to the multiset's cardinality, which Lean's simplifier closes directly.

    line 5

      calc Multiset.card G = (G.map (fun _ => 1)).sum := by simp
  4. The sum of 1 over all blocks is at most the sum of the block sizes: $\sum_{g \in G} 1 \le \sum_{g \in G} |g|$.

    By `Multiset.sum_map_le_sum_map`, it suffices to verify the inequality pointwise for each block $g \in G$. Since each $g \in G$ is non-empty ($g \ne 0$) by the definition of coarsening, `Multiset.card_pos.mpr` shows that $|g| > 0$, or equivalently $1 \le |g|$.

    lines 6–9

    uses Multiset.sum_map_le_sum_map, Multiset.card_pos.mpr

        _ ≤ (G.map Multiset.card).sum := by
            apply Multiset.sum_map_le_sum_map
            intro g hg
            exact Multiset.card_pos.mpr (hG g hg)
Multiset.card_map
Mapping a function over a multiset preserves its cardinality: `(Multiset.map f s).card = s.card`.
Multiset.card_join
The cardinality of the join (flattening) of a multiset of multisets equals the sum of the cardinalities of the constituent multisets: `S.join.card = (Multiset.map Multiset.card S).sum`.
Multiset.sum_map_le_sum_map
If $f(i) \le g(i)$ for every element $i$ in a multiset $s$, then the sum of $f$ over $s$ is at most the sum of $g$ over $s$.
Multiset.card_pos.mpr
A non-empty multiset has strictly positive cardinality: if $s \ne 0$, then $0 < s.\text{card}$ (so $1 \le s.\text{card}$).

Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.

Lean source view module on GitHub

theorem isFactorizationCoarsening_card_le {x y : Multiset ℕ}    (h : IsFactorizationCoarsening x y) : y.card ≤ x.card := by  obtain ⟨G, hG, rfl, rfl⟩ := h  rw [Multiset.card_map, Multiset.card_join]  calc Multiset.card G = (G.map (fun _ => 1)).sum := by simp    _ ≤ (G.map Multiset.card).sum := by        apply Multiset.sum_map_le_sum_map        intro g hg        exact Multiset.card_pos.mpr (hG g hg)
See it in the graphDiscuss this resultChallenge it