# Canonical retriangulation and isometry signature

The canonical retriangulation is a close relative to the canonical cell decomposition defined by Epstein and Penner. Like the canonical cell decomposition, it is intrinsic to a hyperbolic manifold M and is (up to combinatorial isomorphism relabeling the tetrahedra and vertices) completely determined by the isometry type of a hyperbolic manifold. Unlike the canonical cell decomposition, the canonical retriangulation always consists entirely of tetrahedra which makes it more amenable for many computations by SnapPy.

If the canonical cell decomposition of manifold M has only tetrahedral cells, we define the canonical retriangulation to be the canonical cell decomposition. In this case, the canonical retriangulation consists of ideal hyperbolic tetrahedra and the `canonical_retriangulation` method returns a SnapPy manifold. Example:

    sage: M = Manifold("m015")
    sage: K = M.canonical_retriangulation(verified = True)
    sage: K.has_finite_vertices() # False iff all canonical cells tetrahedral
    False

If the canonical cell decomposition has non-tetrahedral cells, we turn it into a topological triangulation as follows: pick a point (called center) in each 3-cell. “Suspend” each 2-cell (which is an ideal n-gon) between the centers of the two neighboring 3-cells. These suspensions form a decomposition of M into topological “diamonds”. Each diamond can be split along its central axis into n tetrahedra. This introduces finite vertices, thus the `verified_canonical_retriangulation` method returns only a SnapPy triangulation. Example (canonical cell is a cube):

    sage: M = Manifold("m412")
    sage: K = M.canonical_retriangulation(verified = True)
    sage: K.has_finite_vertices()
    True

The canonical retriangulation can be used to certifiably find all isometries of a manifold:

    sage: K.isomorphisms_to(K)
    [0 -> 1  1 -> 0
     [1 0]   [1 0]
     [0 1]   [0 1]
     Extends to link,
     ...
     Extends to link]
    sage: len(K.isomorphisms_to(K))
    8

Recall that the isomorphism signature is a complete invariant of the combinatorial isomorphism type of a triangulation that was defined by Burton. We can compute the isomorphism signature of the canonical retriangulation:

    sage: Manifold("m003").canonical_retriangulation(verified = True).triangulation_isosig()
    'cPcbbbdxm'

The resulting invariant was called isometry signature by Goerner and, for convenience, can be accessed by:

    sage: Manifold("m003").isometry_signature(verified = True)
    'cPcbbbdxm'

It is a complete invariant of the isometry type of a hyperbolic manifold. Thus it can be used to easily identify isometric manifolds (here, the last two manifolds have the same isometry signature and thus have to be isomorphic):

    sage: Manifold("m003").isometry_signature(verified = True)
    'cPcbbbdxm'
    sage: Manifold("m004").isometry_signature(verified = True)
    'cPcbbbiht'
    sage: Manifold("4_1").isometry_signature(verified = True)
    'cPcbbbiht'
    sage: Manifold("m004").isometry_signature(verified = True) == Manifold("4_1").isometry_signature(verified = True)
    True

Other applications of the canonical retriangulation include the detection of 2-bridge knots.

## Verifying the canonical retriangulation

snappy.verify.verified_canonical_retriangulation(M, interval_bits_precs=[53, 212], exact_bits_prec_and_degrees=[(212, 10), (1000, 20), (2000, 20)], verbose=False)

  Given some triangulation of a cusped (possibly non-orientable) manifold `M`, return its canonical retriangulation. Return `None` if it could not certify the result.

  To compute the canonical retriangulation, it first prepares the manifold (filling all Dehn-filled cusps and trying to find a proto-canonical triangulation). It then tries to certify the canonical triangulation using interval arithmetics. If this fails, it uses snap (using LLL-algorithm) to guess exact representations of the shapes in the shape field and then certifies that it found the proto-canonical triangulation and determines the transparent faces to construct the canonical retriangulation.

  The optional arguments are:

  - `interval_bits_precs`: a list of precisions used to try to certify the canonical triangulation using intervals. By default, it first tries to certify using 53 bits precision. If it failed, it tries 212 bits precision next. If it failed again, it moves on to trying exact arithmetics.

  - `exact_bits_prec_and_degrees`: a list of pairs (precision, maximal degree) used when the LLL-algorithm is trying to find the defining polynomial of the shape field. Similar to `interval_bits_precs`, each pair is tried until we succeed.

  - `verbose`: If `True`, print out additional information.

  The exact arithmetics can take a long time. To circumvent it, use `exact_bits_prec_and_degrees = None`.

  More information on the canonical retriangulation can be found in the SnapPea kernel `canonize_part_2.c` and in Section 3.1 of Fominykh, Garoufalidis, Goerner, Tarkaev, Vesnin.

  Canonical cell decomposition of `m004` has 2 tetrahedral cells:

      sage: from snappy import Manifold
      sage: M = Manifold("m004")
      sage: K = verified_canonical_retriangulation(M)
      sage: K.has_finite_vertices()
      False
      sage: K.num_tetrahedra()
      2

  Canonical cell decomposition of `m137` is not tetrahedral:

      sage: M = Manifold("m137")
      sage: K = verified_canonical_retriangulation(M)
      sage: K.has_finite_vertices()
      True
      sage: K.num_tetrahedra()
      18

  Canonical cell decomposition of `m412` is a cube and has exactly 8 symmetries:

      sage: M = Manifold("m412")
      sage: K = verified_canonical_retriangulation(M)
      sage: K.has_finite_vertices()
      True
      sage: K.num_tetrahedra()
      12
      sage: len(K.isomorphisms_to(K))
      8

  Burton’s example of `x101` and `x103` which are actually isometric but SnapPea fails to show so. We certify the canonical retriangulation and find them isomorphic:

      sage: M = Manifold('x101'); K = verified_canonical_retriangulation(M)
      sage: N = Manifold('x103'); L = verified_canonical_retriangulation(N)
      sage: len(K.isomorphisms_to(L)) > 0
      True

  Avoid potentially expensive exact arithmetics (return `None` because it has non-tetrahedral cells so interval arithmetics can’t certify it):

      sage: M = Manifold("m412")
      sage: verified_canonical_retriangulation(M, exact_bits_prec_and_degrees = None)