Every manifold is a region, including submanifolds (currently xTensor only allows a submanifold to be strictly lower in dimension than the ambient manifold, so this would mean we couldn't integrate over top-dimension submanifolds---perhaps should be weakened). However, maybe not all regions are manifolds. It is nice to be able to consider a vector space of regions over Z, Q, R, or C. It is also nice to consider the complex of chains by having the boundary operator, with Boundary[Boundary[_]] = 0.
Perhaps this means we should create an abstract Region type (not to be confused with the new builtin Region; discuss later if we should try to connect with this).
As mentioned by Alfonso, we can set UpValues for Boundary[M]. DefManifold could handle an additional option Boundary, e.g. we could say something like Boundary->None for a manifold with vanishing boundary, Boundary[M]^=0. Otherwise, Boundary[M] could just be treated as a d-1 dimensional manifold or chain.
I think it's clear that we should have a notation for the natural pairing between p-forms and p-chains (or p-dimensional (sub)manifolds). If we're doing this on the xTerior side, we should also do it on the xTensor side and allow for integration of scalars on regions of arbitrary dimension—if we have the right density to integrate against.
The natural density to integrate against is the volume element of an induced metric (or more weakly just and induced volume form) for the region. For now let's just talk about metrics and ignore the case of volume element without metric. There are several structures related to this. If we are performing an integral over region R ↪ M of dimension r <= m then we want something like
InducedMetric[g,R][-a,-b],
the metric induced on R from the ambient metric g. The indices -a,-b should really live in Tangent[R] (which is a subbundle of Tangent[M] along R). How do we even know what the rank (<= R) of this metric is, and if it is full rank, what the sign of its determinant is? Do we then introduce
Determinant[InducedMetric[g,R]]
and allow
CovDOfMetric[InducedMetric[g,R]][-a]?
Do we need Gauss-Codazzi equations for this connection relative to the ambient connection of g? In general we need to understand the r+s decomposition, not just the r+1 decomposition. Maybe Guillaume will comment on this.
Back to the reason this is all coming up, including the boundary terms. You'll notice in my example notebook that I just defined some vector n[a]. xTensor would have to pre-define some object to represent the normal vector associated to the boundary of some region. If we have R and Boundary[R], we probably want an object like
NormalVector[Boundary[R]][a].
Of course this could pretty-print as n_{\pd R}^{a} or anything you'd like. This object only makes sense for NormalVector[Boundary[ _ ] ], not for NormalVector[R]. If R is dimension r, then in fact its normal bundle has dimension m-r=s; so there is not a normal vector, but rather an entire bundle. For the special case of the boundary of a region, it has codimension-1 with respect to R, so the normal bundle is 1 dimensional within Tangent[R].
------------------------------------------------------------
This turned out to be a long email. Let me summarize a bit.
1. Should we allow integration of regions of arbitrary dimension?
2. I think regions should have their own type, so we can take formal linear combinations with coefficients in (say) reals.
3. We should have a Boundary[] operator to act on chains (regions), and Boundary[Boundary[_]] = 0.
4. We should have a function to associate a manifold and its boundary. This may also be an option to DefManifold.
5. The right density to integrate against is the volume element of an induced metric on a submanifold.
6. This motivates something like
InducedMetric[g,R][-a,-b], Determinant[InducedMetric[g,R]], CovDOfMetric[InducedMetric[g,R]][-a],
and many related structures, indices in Tangent[R], so on.
7. This requires an understanding of the r+s decomposition (Guillaume's help required :).
8. Need Gauss-Codazzi for r+s?
9. For boundary terms, need object like
NormalVector[Boundary[R]][a].
That's it for now.
Leo