Hi Alejandro,
Thanks for finding and reporting these bugs! I have created issues on the github page:
#3,
#4. Alfonso and I (or others!) will have to think about how to fix them. Here is a temporary solution.
The first bug (issue #3) stems from using Positive[] in some Diff[] code to check if factors are 0-forms or not. This is in Sec. 2.6 of xTerior.nb, in the cell below "We still need definition when acting on Times". Unfortunately, Positive[] doesn't know what to do with e.g. Positive[dimM-1], so those terms don't get detected as being non-0-degree. We need to be much more conservative about this assumption—it's safer to assume something is a non-0-degree form and fix that assumption later. Maybe we need to use =!=0 instead, but I haven't thought about the Mma evaluation very carefully.
One workaround is to teach Positive[] about your assumptions for the dimension of the manifold. You can use this definition:
Unprotect[Positive];
Positive[dimM] := True
Positive[dimM + k_Integer] := Simplify[dimM > -k, Assumptions -> {dimM > 1}]
Protect[Positive];
Notice that in the third line, I made the assumption that the dimension is greater than 1. That means d-1 forms will be understood as being non-0-degree, but not d-2 forms. If you want d-2 forms to have this assumption as well, then you change the assumption to dimM>2. Or, replace that definition with something else if you want all forms to be considered non-0-degree.
I have not yet thought about how to fix the canonicalization bug with forms of degree d-k, and I might not have the expertise to address it. It requires understanding the inner workings of the canonicalizer, which is the most complicated part of xTensor. The internal function AddedSign currently only expects values of +1, -1, or 0, but it's receiving a sign (-1)^dimM. This ought to be considered valid and treated as a constant, since ConstantQ[(-1)^dimM] evaluates to True. But, I haven't attempted to generalize this. Jose or any other ToCanonical expert, do you think this will work?
Best
Leo