Defining objects¶
Every JacoPy computation starts by naming the objects it talks about: functions, vector fields, forms, tensors, a metric, a connection, a frame, an algebroid. This page shows how each of them is written and fixes the names that the other pages on the core layer use.
Reading conventions¶
Objects are defined once. The names below are reused throughout the guide:
f, hfunctions,X, Y, Zvector fields,alpha, beta1-forms,omegaa 2-form,etaa form of symbolic degree \(p\),P, Q, pi2-vectors,Ta \((1,2)\)-tensor,ga metric,nablaa connection,ea frame,Ean algebroid andu, v, wits sections.Factory functions return tuples, even for a single name:
(omega,) = jacopy.forms("omega", degree=2).Operators are constructed first, then applied. \(\mathcal L_X\omega\) is written
jacopy.lie_derivative(X)(omega):jacopy.lie_derivative(X)is the operator \(\mathcal L_X\) and(omega)applies it.Expressions are inert. Writing
X(f)orjacopy.lie_bracket(X, Y)builds an expression and performs no computation. Expansion, simplification and proof are done by an engine (see Running proofs).Several names are given in one string separated by spaces (
"X Y Z"). Greek names are spelled out ("alpha") and are rendered as \(\alpha\) in LaTeX.
The standard setup¶
The block below creates every object used on the core-layer pages. Each of those pages repeats it at the top, so that every page can be run on its own.
import jacopy
from jacopy.core import Degree, Scalar
from jacopy.core import (Closed, NonDegenerate, Poisson, Symmetric, Antisymmetric,
GradedAntisymmetric, AntiCommuting, GradedCommutative, Graded)
from jacopy.central.objects.frame import FrameIndex
from jacopy.central.algebroid import (algebroid, tangent_algebroid, section_map,
locality_projector, DECLARATIONS, LEVELS)
reg = jacopy.PropertyRegistry()
f, h = jacopy.functions("f h", registry=reg)
lam = jacopy.Symbol("lambda"); reg.declare(lam, Scalar())
two, half = jacopy.Integer(2), jacopy.Rational(1, 2)
M3 = jacopy.tangent_bundle(dim=3)
X, Y, Z = jacopy.vector_fields("X Y Z")
alpha, beta = jacopy.forms("alpha beta", degree=1)
(omega,) = jacopy.forms("omega", degree=2)
p = Degree.var("p"); (eta,) = jacopy.forms("eta", degree=p)
P, Q = jacopy.p_vectors("P Q", degree=2)
pi = jacopy.bivector("pi")
(T,) = jacopy.tensors("T", upper=1, lower=2)
g = jacopy.metric("g"); ginv = g.inverse()
g3 = jacopy.metric("g", bundle=M3)
nabla = jacopy.connection()
e = jacopy.frame("e"); ce = jacopy.coframe("e")
ea, eb = e.fields("a b"); ea_up = ce.field("a")
s = FrameIndex("s")
D = jacopy.Derivation("D", degree=1)
Objects¶
The table lists the same objects one by one.
Object (mathematics) |
In code |
What it does |
Typical name |
|---|---|---|---|
Property registry |
|
Stores declarations (”\(f\) is a function”, “\(\lambda\) is a constant”, “\(\omega\) is closed”). Every proof is given |
|
Functions \(f,h\in C^\infty(M)\) |
|
Smooth functions of degree 0, recorded in |
|
Real constant \(\lambda\in\mathbb R\) |
|
A constant, not a function: every derivation kills it (\(X(\lambda)=0\)) and it commutes freely in products. |
|
Numbers \(2,\ \tfrac12\) |
|
Integer and rational coefficients. Python numbers also work directly: |
|
Tangent bundle \(TM\) (symbolic dimension \(n\)) |
|
The ready-made \(TM\); its dimension is a symbolic \(n\). Every object created without an explicit bundle lives on it. |
|
\(TM\) of concrete dimension (\(\dim M=3\)) |
|
\(TM\) of fixed dimension (for example \(n=3\) for the Hodge star). |
|
Vector fields \(X,Y,Z\in\mathfrak X(M)\) |
|
Sections of \(TM\); they act on functions as derivations: |
|
1-forms \(\alpha,\beta\in\Omega^1(M)\) |
|
Greek names may be spelled out ( |
|
2-form \(\omega\in\Omega^2(M)\) |
|
Alternating; evaluated on exactly two vectors. |
|
Form of symbolic degree \(\eta\in\Omega^p(M)\) |
|
Its degree is a symbolic \(p\); Koszul signs are resolved through its parity. Do not call the variable |
|
2-vectors \(P,Q\in\Gamma(\Lambda^2TM)\) |
|
Evaluated on covectors: |
|
Bivector \(\pi\) |
|
Shortcut for a single 2-vector (for example a Poisson bivector). |
|
\((1,2)\)-tensor \(T\) |
|
|
|
Metric \(g\) and its inverse \(g^{-1}\) |
|
Symmetric \(g(X,Y)\); |
|
Metric \(g\) in dimension 3 |
|
Makes \(n=3\) concrete in the Hodge star. |
|
Connection \(\nabla\) |
|
Default name \(\nabla\). |
|
Frame \((e_a)\) and coframe \((e^a)\) |
|
Context objects, not expressions. A frame and a coframe with the same name are dual to each other ( |
|
Frame fields \(e_a,e_b\) and \(e^a\) |
|
Indexed vector fields and 1-forms. |
|
Bound (dummy) index \(s\) |
|
Index used in sums \(\sum_s\). |
|
Graded derivation \(D\), \(\lvert D\rvert=1\) |
|
A named graded derivation; |
|
Leibniz algebroid \((E,\rho,[\cdot,\cdot]_E)\) |
|
|
|
Sections \(u,v,w\in\Gamma(E)\) |
|
Sections of the bundle \(E\); they act on functions only through the anchor. |
|
\(E\)-1-form \(\mu\in\Gamma(E^*)\) |
|
The form bundle is selected with |
|
Algebroid without axioms \(A\) and its sections |
|
No axioms at all, only definitions. The defect formulas live here. |
|
Lie algebroid with anchor morphism \(K\) |
|
|
|
Courant algebroid \(C\) (with fibre metric) |
|
|
|
Local, regular algebroid \(R\) and locality projector \(\mathcal P\) |
|
|
|
Section maps \(\Phi:E\to E\), \(\psi:E\to TM\) |
|
\(C^\infty\)-linear bundle maps (\(E\to E\) for the Derivator, \(E\to TM\) for the Predator). |
|
Local pre-Leibniz algebroid \(L_p\), antisymmetric algebroid \(A_s\) |
|
Used to supply the hypotheses of some ready-made theorems. |
|
Tangent algebroid \((TM,\mathrm{id},[\cdot,\cdot])\) |
|
The case \(E=TM\): the anchor is the identity and the bracket is the Lie bracket. It has no declarations; everything is a theorem. |
|
Scalar or function? jacopy.functions() defines smooth functions
\(f\in C^\infty(M)\). A derivation either kills them or expands them by the Leibniz rule,
\(X(fh)=X(f)h+fX(h)\). A real constant is a jacopy.Symbol declared with
reg.declare(lam, Scalar()); after this declaration every derivation kills it
(\(X(\lambda)=0\), \(d\lambda=0\)) and it commutes freely in products. Numbers such as 2 or
jacopy.Rational(1, 2) are already constants.
Symbolic dimension. The dimension of jacopy.TM is a symbolic \(n\), and every object
created without an explicit bundle is built on it, so proofs run in this abstract setting.
When a concrete dimension is needed (for example \(n=3\) in the Hodge star), create
M3 = jacopy.tangent_bundle(dim=3) and pass bundle=M3 to the object.
Property declarations¶
Declarations are written reg.declare(object, Property()). The central engines and the
simplifier read Scalar, Graded, AntiCommuting and GradedCommutative. The other
properties are recorded in the registry and can be queried, but no engine currently acts on
them: declaring Closed, for example, does not make the tangent engine reduce \(d\omega\) to
zero. Package axioms such as \([\pi,\pi]_{SN}=0\) are declared on the package structures
instead (see Poisson). Declaring the same property twice on the same object
raises ValueError.
Mathematics |
In code |
Meaning |
Read by the engines |
|---|---|---|---|
Is \(\lambda\) constant? |
|
query for the constant declared above (returns |
yes: \(D(\lambda)=0\), free commutation |
\(\lvert\varphi\rvert=1\) |
|
degree declaration ( |
yes: Koszul signs |
\(d\omega=0\) |
|
closed form |
recorded only |
\(\omega\) non-degenerate |
|
\(X\mapsto\iota_X\omega\) is injective |
recorded only |
\([\pi,\pi]_{SN}=0\) |
|
Poisson bivector |
recorded only |
\(B(a,b)=B(b,a)\) |
|
symmetry |
recorded only |
\(B(a,b)=-B(b,a)\) |
|
antisymmetry |
recorded only |
\(B(a,b)=-(-1)^{\lvert a\rvert\lvert b\rvert}B(b,a)\) |
|
graded antisymmetry |
recorded only |
\(ab=-ba\) |
|
ungraded anticommutation |
yes: product sorting in the simplifier |
\(ab=(-1)^{\lvert a\rvert\lvert b\rvert}ba\) |
|
graded commutativity |
yes: product sorting in the simplifier |
Is \(\omega\) closed? |
|
declaration query (returns |
|
The declaration itself |
|
the property object, with provenance |
The declaration and the same queries in a script:
reg.declare(omega, Closed())
print(reg.has(lam, Scalar), reg.has(omega, Closed))
print(reg.get(omega, Closed))
True True
Closed(provenance=<Provenance.AXIOM: 'axiom'>, proof=None)
Bulk and temporary declarations¶
A registry can also declare a property for a whole class or for every object matching a
predicate, roll declarations back at the end of a with block, or hide all properties
except a chosen set:
reg2 = jacopy.PropertyRegistry()
reg2.declare_for_class(jacopy.Symbol, Scalar()) # every Symbol is a constant
reg2.declare_for_predicate(lambda x: getattr(x, "name", "") == "q", Graded(1))
c0 = jacopy.Symbol("c0")
print(reg2.has(c0, Scalar)) # inherited from the class
with reg2.scope(): # rolled back at the end
reg2.declare(c0, Closed())
print(reg2.has(c0, Closed))
print(reg2.has(c0, Closed))
with reg2.axioms([Graded]): # only Graded is visible
print(reg2.get(c0, Scalar))
True
True
False
None