jacopy.brackets.GradedBracket

class jacopy.brackets.GradedBracket(name, *, degree=0, is_graded_antisymmetric=True, satisfies_leibniz=True, satisfies_graded_jacobi=True)

Bases: ABC

Abstract graded bracket on a graded module.

Subclasses declare their degree and axiom flags via __init__ and implement expand(). The default axiom flags reflect the most common case (degree 0, antisymmetric, Leibniz, Jacobi holds); override in subclasses for anything exotic.

Parameters:
  • name (str)

  • degree (DegreeLike)

  • is_graded_antisymmetric (bool)

  • satisfies_leibniz (bool)

  • satisfies_graded_jacobi (Optional[bool])

__init__(name, *, degree=0, is_graded_antisymmetric=True, satisfies_leibniz=True, satisfies_graded_jacobi=True)
Parameters:
  • name (str)

  • degree (int | Degree)

  • is_graded_antisymmetric (bool)

  • satisfies_leibniz (bool)

  • satisfies_graded_jacobi (bool | None)

Return type:

None

Methods

__init__(name, *[, degree, ...])

claimed_swap_sign(a, b[, registry])

ε in the graded-antisymmetry CLAIM [a, b] = ε·[b, a]: ε = −(−1)^{s(a)s(b)} with s = operand_degree().

expand(a, b[, registry])

Return the definitional expansion of [a, b].

graded_antisymmetry_obstruction(a, b[, registry])

[a, b] + (−1)^{s(a)s(b)} [b, a] (= [a, b] − ε[b, a] with ε = claimed_swap_sign()).

graded_jacobi_obstruction(a, b, c[, registry])

grading_degree(x[, registry])

|x| — the operand's degree in the module's own grading (the grading of module_product()).

jacobi_term_sign(A, B, C[, registry])

Sign (−1)^{s(A)s(C)} of the [A, [B, C]] summand in the cyclic graded Jacobi Σ_cyc (−1)^{s(A)s(C)} [A, [B, C]] = 0 (s = operand_degree()).

leibniz_obstruction(a, b, c[, registry])

[a, b·c] − [a, b]·c − (−1)^{s(a)|b|} b·[a, c], · = module_product(), sign from leibniz_term_sign().

leibniz_term_sign(a, b[, registry])

Sign (−1)^{s(a)|b|} of b·[a, c] in the Leibniz claim [a, b·c] = [a, b]·c + (−1)^{s(a)|b|} b·[a, c]: ad_a has degree s(a) = |a| + k and passes b of UNSHIFTED degree |b|.

module_product(b, c)

The product the Leibniz axiom distributes over (default: Product).

operand_degree(x[, registry])

s(x) = |x| + k — the SHIFTED degree in which the bracket is graded antisymmetric and satisfies graded Jacobi.

pair_swap_sign(a, b[, registry])

Sign ε such that [a, b] = ε·[b, a] HOLDS — a rewrite licence: claimed_swap_sign() for a bracket asserted graded antisymmetric, None (decline: do not rewrite) for any other bracket, a symbolic parity OR an undeterminable operand degree (a licence never raises — an unknown degree means no rule fires, no closure).

Attributes

degree

is_graded_antisymmetric

name

operand_shift

the bracket's degree there (default: degree; for SN it is −1 in the multivector grading although degree is recorded in the already-shifted convention).

satisfies_graded_jacobi

True / False / None (conditional).

satisfies_leibniz

property satisfies_graded_jacobi: bool | None

True / False / None (conditional).

grading_degree(x, registry=None)

|x| — the operand’s degree in the module’s own grading (the grading of module_product()). Default: the operator grading degree_of(). Raises ValueError when the degree is undeterminable.

Parameters:
Return type:

Degree

property operand_shift: Degree

the bracket’s degree there (default: degree; for SN it is −1 in the multivector grading although degree is recorded in the already-shifted convention).

Type:

k measured in grading_degree()’s grading

operand_degree(x, registry=None)

s(x) = |x| + k — the SHIFTED degree in which the bracket is graded antisymmetric and satisfies graded Jacobi.

Parameters:
Return type:

Degree

module_product(b, c)

The product the Leibniz axiom distributes over (default: Product).

Parameters:
Return type:

Expr

claimed_swap_sign(a, b, registry=None)

ε in the graded-antisymmetry CLAIM [a, b] = ε·[b, a]: ε = −(−1)^{s(a)s(b)} with s = operand_degree().

The sign the axiom STATES (what graded_antisymmetry_obstruction() builds and a skew check tests), whether or not the bracket satisfies it. None when the parity is symbolic; an undeterminable degree raises ValueError.

Parameters:
Return type:

int | None

pair_swap_sign(a, b, registry=None)

Sign ε such that [a, b] = ε·[b, a] HOLDS — a rewrite licence: claimed_swap_sign() for a bracket asserted graded antisymmetric, None (decline: do not rewrite) for any other bracket, a symbolic parity OR an undeterminable operand degree (a licence never raises — an unknown degree means no rule fires, no closure).

Parameters:
Return type:

int | None

jacobi_term_sign(A, B, C, registry=None)

Sign (−1)^{s(A)s(C)} of the [A, [B, C]] summand in the cyclic graded Jacobi Σ_cyc (−1)^{s(A)s(C)} [A, [B, C]] = 0 (s = operand_degree()). None when symbolic.

Parameters:
Return type:

int | None

leibniz_term_sign(a, b, registry=None)

Sign (−1)^{s(a)|b|} of b·[a, c] in the Leibniz claim [a, b·c] = [a, b]·c + (−1)^{s(a)|b|} b·[a, c]: ad_a has degree s(a) = |a| + k and passes b of UNSHIFTED degree |b|. None when symbolic.

Parameters:
Return type:

int | None

abstractmethod expand(a, b, registry=None)

Return the definitional expansion of [a, b].

Subclasses implement this with their concrete formula. The expansion is purely syntactic, it does not invoke simplify / canonicalize; the caller pipes the result through whichever reductions they need.

Parameters:
Return type:

Expr

graded_antisymmetry_obstruction(a, b, registry=None)

[a, b] + (−1)^{s(a)s(b)} [b, a] (= [a, b] − ε[b, a] with ε = claimed_swap_sign()).

Claims to be zero exactly when the bracket is graded antisymmetric on (a, b) in its shifted convention s = |·| + k (operand_degree(); for Schouten–Nijenhuis s = m − 1, the multivector degree minus one). Unshifted degrees for k ≠ 0 would build the WRONG obstruction, and the operator degree for SN would claim [π, π]_SN = 0 for every bivector. Undecidable parity raises ValueError.

Parameters:
Return type:

Expr

graded_jacobi_obstruction(a, b, c, registry=None)
Cyclic Jacobi with Koszul signs in the shifted convention:

    (−1)^{s(a)s(c)} [a, [b, c]]
  + (−1)^{s(b)s(a)} [b, [c, a]]
  + (−1)^{s(c)s(b)} [c, [a, b]]

with ``s`` = :meth:`operand_degree` and each sign read from
:meth:`jacobi_term_sign`. Undecidable parity raises
:class:`ValueError`.
Parameters:
Return type:

Expr

leibniz_obstruction(a, b, c, registry=None)

[a, b·c] − [a, b]·c − (−1)^{s(a)|b|} b·[a, c], · = module_product(), sign from leibniz_term_sign().

Claims to be zero when the bracket acts as a graded derivation in its second slot. Undecidable sign parity raises.

Parameters:
Return type:

Expr