Hey Simon, > > What about a mixed approach: It seems that you have, on the one hand, > nice manifolds that you know by name (S^n, T^n, RR^n, L(p,q), ...). You > want that manifolds that you know by name are identical if and only if > they have the same name. But you also want to be able to build more > complicated manifolds, where you would soon run into non-decidable > homeomorphism tests. > > My suggestion would be: > - Start with CachedRepresentation. In that way, manifolds defined with > input will > be identical. This would also cover pickling. > - If the manifold has a name or a normal form, then store it as an > attribute > (if I recall correctly, CachedRepresentation stores the input data > anyway, so, > you could just use what CachedRepresentation gives you). > - Implement a comparison as follows: > * If L and R are named and have the same name, then they are equal. > * If L and R have a known algorithm for computing a normal form, then > compute the normal form and store the result as an attribute (or > just read the attribute if it exists) and do comparison accordingly. > * Otherwise, it depends what you want. You could just stop and raise > an error, saying that you can't decide equality. Or you could start > a heuristics (such as a simulated annealing algorithm on Pachner > moves for PL-manifolds). Or you could attempt a deterministic > algorithm that may take ages. > In the last two cases, it would be good to print a warning to the > user, at least if verbosity is greater than 0. > - Or IF you really want to use them as dictionary keys, then just let > manifolds compare by identity (so, you allow that two homeomorphic > manifolds evaluate as non-equal), and have a separate method > M.is_homeomorphic(N) > that does the real thing (but is only invoked if the user asks for > it). > > In that way, you would have super-fast equality-by-identity in the > obvious cases, but would still have a framework for the difficult cases, > where you postpone all unsolvable problems until the user wants them > solved. > > I would then be advocating for using UniqueRepresentation if that was the only issue. However the problem I see is this (even for using CachedRepresentation). Suppose you created a 2-sphere called 'S', and then you created a manifold called 'M' and worked with that for a while, took a lunch break, came back and did some more work. Then you wanted to create a genus 3 surface called 'S' in the same session. All of a sudden, to your surprise, you have charts that tell you 'S' is a sphere (because you forgot you had one previously defined). This also means we have to have `_clear_cache_()` calls all throughout the doctests.
So I'm somewhat inclined to use EqualityById and let the pickling be broken (and redefining _test_pickling to do nothing (i.e., passes) with a docstring warning that it is intentionally broken). I'm starting to become really convinced that this is the way to go. Best, Travis -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.