AFTD Auto-Formalizing Theoretical Domains

isFactorizationCoarsening_card_lt_iff_ne

theoremverified

A coarsening y of x has fewer elements than x exactly when y differs from x; this justifies reading y.card < x.card as x < y in the Möbius recursion.

Statement

theorem isFactorizationCoarsening_card_lt_iff_ne {x y : Multiset ℕ}
    (h : IsFactorizationCoarsening x y) : y.card < x.card ↔ y ≠ x
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 2
Used by 1
  • factorization_mobius_simple_primeTheorem 1 of arXiv:2611.18194. Let n = mq where q is a prime not dividing m, and let x be a factorization of n (a multiset of integers…

The proof, explained

A coarsening y of x is obtained by grouping elements of x into nonempty blocks and replacing each block with its product; in particular, |y| ≤ |x|. The forward direction (|y| < |x| → y ≠ x) holds because strict inequality is irreflexive. For the reverse direction (y ≠ x → |y| < |x|), it suffices to show that |y| = |x| forces y = x: the size |x| is the sum of sizes of the blocks while |y| is the number of blocks, so |y| = |x| implies by induction that every block has cardinality 1, which means no grouping takes place and y = x.

  1. Strict inequality |y| < |x| implies y ≠ x.

    We split the equivalence into two directions. In the forward direction, assuming |y| < |x| and y = x would give |y| < |y|, contradicting the irreflexivity of strict inequality (`lt_irrefl`).

    lines 3–4

    uses lt_irrefl

      constructor
      · rintro hlt rfl; exact lt_irrefl _ hlt
  2. To show |y| < |x| when y ≠ x, it suffices to eliminate the possibility that |y| = |x|.

    Assuming y ≠ x, since y is a coarsening of x, we already have |y| ≤ |x| by `isFactorizationCoarsening_card_le`. By `lt_or_eq_of_le`, either |y| < |x| (which directly proves the goal) or |y| = |x|, so only the equality case remains to be refuted.

    lines 5–7

    uses lt_or_eq_of_le, isFactorizationCoarsening_card_le

      · intro hne
        rcases lt_or_eq_of_le (isFactorizationCoarsening_card_le h) with hlt | heq
        · exact hlt
  3. Refuting |y| = |x| reduces to proving G.map Multiset.prod = G.join when |G| = ∑_{g ∈ G} |g|.

    In the equality case |y| = |x|, we derive a contradiction by proving y = x, which opposes y ≠ x. Unpacking the coarsening hypothesis h gives a multiset G of nonempty multisets such that x = G.join and y = G.map Multiset.prod. Using `Multiset.card_map` and `Multiset.card_join`, |y| = |x| translates into |G| = ∑_{g ∈ G} |g|, and the goal y = x becomes G.map Multiset.prod = G.join.

    lines 8–11

    uses Multiset.card_map, Multiset.card_join

        · exfalso; apply hne
          obtain ⟨G, hG, rfl, rfl⟩ := h
          rw [Multiset.card_map, Multiset.card_join] at heq
          clear hne
  4. When G is empty, G.map Multiset.prod = G.join.

    We proceed by induction on G using `Multiset.induction_on`. In the base case G = ∅, both G.map Multiset.prod and G.join evaluate to ∅, so the equality holds by simplification.

    lines 12–13

    uses Multiset.induction_on

          induction G using Multiset.induction_on with
          | empty => simp
  5. In the inductive step G = g ::ₘ G, the head block g and every block in the tail G are nonempty.

    Since every element of g ::ₘ G is nonempty by assumption, g ≠ 0 (using `Multiset.mem_cons_self`) and every g' ∈ G satisfies g' ≠ 0 (using `Multiset.mem_cons_of_mem`).

    lines 14–16

    uses Multiset.mem_cons_self, Multiset.mem_cons_of_mem

          | cons g G ih =>
            have hg : g ≠ 0 := hG g (Multiset.mem_cons_self g G)
            have hG' : ∀ g ∈ G, g ≠ 0 := fun g' hg' => hG g' (Multiset.mem_cons_of_mem hg')
  6. The tail satisfies |G| ≤ ∑_{g' ∈ G} |g'|, and the head block satisfies |g| > 0.

    Because each block g' ∈ G is nonempty, its cardinality is at least 1 by `Multiset.card_pos.mpr`. Summing this over G with `Multiset.sum_map_le_sum_map` shows |G| = ∑_{g' ∈ G} 1 ≤ ∑_{g' ∈ G} |g'|. Likewise, since g ≠ 0, we have 0 < |g|.

    lines 17–21

    uses Multiset.sum_map_le_sum_map, Multiset.card_pos.mpr

            have hle : Multiset.card G ≤ (G.map Multiset.card).sum := by
              calc Multiset.card G = (G.map (fun _ => 1)).sum := by simp
                _ ≤ (G.map Multiset.card).sum :=
                  Multiset.sum_map_le_sum_map _ _ (fun g' hg' => Multiset.card_pos.mpr (hG' g' hg'))
            have hgpos := Multiset.card_pos.mpr hg
  7. The head block has size |g| = 1 and the tail satisfies |G| = ∑_{g' ∈ G} |g'|.

    Simplifying the equality of cardinalities for g ::ₘ G using `Multiset.card_cons`, `Multiset.map_cons`, and `Multiset.sum_cons` gives |G| + 1 = |g| + ∑_{g' ∈ G} |g'|. Since |g| ≥ 1 and |G| ≤ ∑_{g' ∈ G} |g'|, linear arithmetic (`omega`) forces both |g| = 1 and |G| = ∑_{g' ∈ G} |g'|.

    lines 22–24

    uses Multiset.card_cons, Multiset.map_cons, Multiset.sum_cons

            simp only [Multiset.card_cons, Multiset.map_cons, Multiset.sum_cons] at heq
            have hg1 : Multiset.card g = 1 := by omega
            have hrest : Multiset.card G = (G.map Multiset.card).sum := by omega
  8. The head block is a singleton {a}, and G.map Multiset.prod = G.join holds for g ::ₘ G.

    Since |g| = 1, g is a singleton {a} for some integer a by `Multiset.card_eq_one.mp`. Rewriting with `Multiset.map_cons`, `Multiset.join_cons`, and the induction hypothesis reduces the goal to {a}.prod ::ₘ G.join = {a} + G.join. Because the product of a singleton {a} is a and {a} + G.join = a ::ₘ G.join, simplification closes the inductive step.

    lines 25–27

    uses Multiset.card_eq_one.mp, Multiset.map_cons, Multiset.join_cons

            obtain ⟨a, rfl⟩ := Multiset.card_eq_one.mp hg1
            rw [Multiset.map_cons, Multiset.join_cons, ih hG' hrest]
            simp
lt_irrefl
Strict inequality is irreflexive: no element is strictly less than itself (¬(a < a)).
lt_or_eq_of_le
If a ≤ b in a partial order, then either a < b or a = b.
isFactorizationCoarsening_card_le
A factorization coarsening y of x has multiset cardinality at most that of x (|y| ≤ |x|).
Multiset.card_map
Mapping a function over a multiset preserves its cardinality: |map f s| = |s|.
Multiset.card_join
The cardinality of the join of a multiset of multisets is the sum of the cardinalities of its elements: |S.join| = ∑_{s ∈ S} |s|.
Multiset.induction_on
Multiset induction: to prove a property for all multisets, it suffices to prove it for the empty multiset and show that it is preserved by adding an element.
Multiset.mem_cons_self
An element a belongs to the multiset a ::ₘ s.
Multiset.mem_cons_of_mem
If an element belongs to s, then it also belongs to b ::ₘ s.
Multiset.sum_map_le_sum_map
If f(i) ≤ g(i) for all elements i ∈ s, then the sum of f over s is at most the sum of g over s.
Multiset.card_pos.mpr
A multiset has strictly positive cardinality if and only if it is nonempty.
Multiset.card_cons
Adding an element to a multiset increases its cardinality by 1: |a ::ₘ s| = |s| + 1.
Multiset.map_cons
Mapping a function f over a ::ₘ s yields f(a) ::ₘ map f s.
Multiset.sum_cons
The sum of elements in a ::ₘ s equals a + sum(s).
Multiset.card_eq_one.mp
If a multiset has cardinality 1, it is a singleton {a} for some element a.
Multiset.join_cons
The join of s ::ₘ S is the multiset sum s + S.join.

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_lt_iff_ne {x y : Multiset ℕ}    (h : IsFactorizationCoarsening x y) : y.card < x.card ↔ y ≠ x := by  constructor  · rintro hlt rfl; exact lt_irrefl _ hlt  · intro hne    rcases lt_or_eq_of_le (isFactorizationCoarsening_card_le h) with hlt | heq    · exact hlt    · exfalso; apply hne      obtain ⟨G, hG, rfl, rfl⟩ := h      rw [Multiset.card_map, Multiset.card_join] at heq      clear hne      induction G using Multiset.induction_on with      | empty => simp      | cons g G ih =>        have hg : g ≠ 0 := hG g (Multiset.mem_cons_self g G)        have hG' : ∀ g ∈ G, g ≠ 0 := fun g' hg' => hG g' (Multiset.mem_cons_of_mem hg')        have hle : Multiset.card G ≤ (G.map Multiset.card).sum := by          calc Multiset.card G = (G.map (fun _ => 1)).sum := by simp            _ ≤ (G.map Multiset.card).sum :=              Multiset.sum_map_le_sum_map _ _ (fun g' hg' => Multiset.card_pos.mpr (hG' g' hg'))        have hgpos := Multiset.card_pos.mpr hg        simp only [Multiset.card_cons, Multiset.map_cons, Multiset.sum_cons] at heq        have hg1 : Multiset.card g = 1 := by omega        have hrest : Multiset.card G = (G.map Multiset.card).sum := by omega        obtain ⟨a, rfl⟩ := Multiset.card_eq_one.mp hg1        rw [Multiset.map_cons, Multiset.join_cons, ih hG' hrest]        simp
See it in the graphDiscuss this resultChallenge it