Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

moebius-inversion

БесплатноБез исполняемых скриптовНе проверен

Möbius inversion on posets and lattices: alternating sums, chromatic polynomials, incidence algebras, and centrality predicates.

plurigridот plurigrid★ 73 звезды на GitHub

Об этом скилле

Möbius Inversion Skill

"The Möbius function inverts summation over divisors - the fundamental tool connecting local constraints to global structure."

bmorphism Contributions

"all is bidirectional" — @bmorphism, Play/Coplay gist

Categorical Connection: Möbius inversion on posets is the prototypical example of adjunction in category theory — ζ and μ form a zeta-Möbius pair where convolution is the composition operation. This connects to:

  • Incidence algebras as categorical structures on posets
  • Bidirectional computation — inversion recovers local from global
  • Chromatic polynomials via ACSet bond lattices

Plurigrid Integration: The GF(3) trit system uses μ(3) = -1 (3 is prime) as the fundamental sign flip that creates the action-perception duality:

  • Action trits: {-, 0, +}
  • Perception trits: {+, 0, -} (Möbius-inverted)
  • Double inversion: μ ∘ μ = identity

Key Reference:

  • Rota (1964) — "On the Foundations of Combinatorial Theory I: Theory of Möbius Functions"

Overview

Möbius inversion provides:

  1. Alternating sums - Invert cumulative sums to get point values
  2. Chromatic polynomials - Count colorings via bond lattice
  3. Incidence algebras - Algebraic structure on posets
  4. Centrality predicates - Validate node importance via inversion

Classical Möbius Function

Definition

For positive integers:

μ(n) = { 1      if n = 1
       { (-1)^k if n = p₁p₂...pₖ (k distinct primes)
       { 0      if n has squared prime factor

Key Values

n μ(n) Meaning
1 1 Identity
2 -1 Prime
3 -1 Prime - key for GF(3)
4 0 Squared (2²)
5 -1 Prime
6 1 Two primes (2·3)
12 0 Has 2²
30 -1 Three primes (2·3·5)

Implementation

function moebius(n)
    if n == 1
        return 1
    end
    
    # Factor n
    factors = factor(n)
    
    # Check for squared factors
    for (p, e) in factors
        if e > 1
            return 0
        end
    end
    
    # (-1)^(number of prime factors)
    return (-1)^length(factors)
end

Möbius Inversion Formula

For Divisors

If f(n) = Σ_{d|n} g(d) then:

g(n) = Σ_{d|n} μ(n/d) × f(d)
     = Σ_{d|n} μ(d) × f(n/d)

Example: Euler's Totient

# φ(n) counts integers 1 ≤ k ≤ n with gcd(k,n) = 1
# We have: n = Σ_{d|n} φ(d)
# By Möbius inversion: φ(n) = Σ_{d|n} μ(n/d) × d

function euler_totient(n)
    result = 0
    for d in divisors(n)
        result += moebius(n ÷ d) * d
    end
    return result
end

Möbius on Posets

General Definition

For a locally finite poset (P, ≤), the Möbius function μ: P × P → ℤ is:

μ(x, x) = 1
μ(x, y) = -Σ_{x ≤ z < y} μ(x, z)  if x < y
μ(x, y) = 0                        if x ≰ y

Inversion on Posets

If f(x) = Σ_{y ≤ x} g(y) then:

g(x) = Σ_{y ≤ x} μ(y, x) × f(y)

Implementation

struct Poset
    elements::Vector
    leq::Function  # (x, y) -> Bool
end

function moebius_poset(P::Poset, x, y)
    if x == y
        return 1
    end
    if !P.leq(x, y)
        return 0
    end
    
    # Sum over interval [x, y)
    result = 0
    for z in P.elements
        if P.leq(x, z) && P.leq(z, y) && z != y
            result -= moebius_poset(P, x, z)
        end
    end
    return result
end

Chromatic Polynomial

Bond Lattice

For a graph G, the bond lattice L(G) consists of partitions of V(G) induced by edge subsets.

Whitney's Formula

The chromatic polynomial P(G, k) counts proper k-colorings:

P(G, k) = Σ_{π ∈ L(G)} μ(0̂, π) × k^{|π|}

where |π| is the number of parts in partition π.

Implementation

function chromatic_polynomial(G, k)
    """
    Compute P(G, k) via Möbius inversion on bond lattice.
    """
    partitions = bond_lattice(G)
    
    result = 0
    for π in partitions
        μ_val = moebius_bond_lattice(G, partition_0, π)
        result += μ_val * k^(num_parts(π))
    end
    
    return result
end

Deletion-Contraction

Alternative recursive formula:

function chromatic_deletion_contraction(G, k)
    if ne(G) == 0
        return k^nv(G)
    end
    
    e = first(edges(G))
    G_delete = delete_edge(G, e)
    G_contract = contract_edge(G, e)
    
    return chromatic_deletion_contraction(G_delete, k) - 
           chromatic_deletion_contraction(G_contract, k)
end

Alternating Möbius for GF(3)

Sign Inversion Symmetry

For GF(3) = {-1, 0, +1}:

Action:     {-, 0, +}
Perception: {+, 0, -}  (Möbius-inverted)

μ × μ = identity (applying twice returns original)

Perception-Action Duality

function moebius_duality(state::GF3)
    """
    Möbius inversion creates observer/observed duality.
    Action and perception are inverted images.
    """
    # μ(3) = -1 for our tritwise system
    μ_3 = -1
    
    return state * μ_3
e
Полный SKILL.md на GitHub

Установить moebius-inversion в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл moebius-inversion?

Möbius inversion on posets and lattices: alternating sums, chromatic polynomials, incidence algebras, and centrality predicates.

Как установить скилл moebius-inversion?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл moebius-inversion запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить moebius-inversion с