Documentation

Physlib.Relativity.Tensors.Elab

Elaboration of tensor expressions #

Examples #

Comments #

Indices #

A syntax category for indices of tensor expressions.

Equations
Instances For
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For

      A basic index is a ident.

      Equations
      Instances For

        An index can be a num, which will be used to evaluate the tensor.

        Equations
        Instances For

          Notation to describe the evaluation of a tensor index. The term inside the brackets is the value of the index, which can be an identifier [μ] or an arbitrary term such as [Sum.inl 0].

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For

            Notation to describe the jiggle of a tensor index.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For

              Bool which is true if an index is a num.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For

                Bool which is true if an index is a jiggle τ(i).

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For

                  Removes a τ(⬝) wrapper from an index, leaving any other index unchanged. Pure, so it can be used to compare indices up to τ (e.g. when counting contractions in withoutContrEval).

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For

                    Bool which is true if an index is evaluated bracket [μ].

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For

                      If an index is a num - the underlying natural number.

                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For

                        When an index is not a num, the corresponding ident.

                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For

                          For an evaluated bracket index [t], the term t giving the value of the index.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For

                            Takes a pair a b : ℕ × TSyntax `indexExpr. If a.1 < b.1 and a.2 = b.2 then outputs some (a.1, b.1), otherwise none.

                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For

                              Bool which is true if an index is of the form τ(i) that is, to be dualed.

                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For

                                Manipulation of lists of indexExpr #

                                Adjusts a list List ℕ by subtracting from each natural number the number of elements before it in the list which are less than itself. This is used to form a list of pairs which can be used for evaluating indices.

                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For

                                  Returns the positions of indices which are "jiggled", i.e., of the form τ(μ), these are the indices which are to be raised or lowered.

                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For

                                    For list of indexExpr e.g. [α, 3, β, 2, γ], getEvalPos returns a list of pairs ℕ × ℕ related to indices which are numbers. The second element of each pair is the number corresponding to that index. The first element is the position of that number in the list of indices when all other numbered indices before it are removed. Thus for the example given getEvalPos outputs [(1, 3), (2, 2)].

                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For

                                      For list of indexExpr e.g. [α, 3, β, 2, [γ]], getEvalPos returns a list of pairs ℕ × Term related to indices which are evaluated e.g. [μ]. The second element of each pair is the value corresponding to that index. The first element is the position of that number in the list of indices when all other numbered indices before it are removed. Thus for the example given getEvalBracketPos outputs [(4, γ)].

                                      Equations
                                      • One or more equations did not get rendered due to their size.
                                      Instances For

                                        For list of indexExpr e.g. [α, 3, β, α, 2, γ], getContrPos first removes all indices which are numbers (e.g. [α, β, α, γ]). It then outputs pairs (a, b) in ℕ × ℕ of positions of this list with a < b such that the index at a is equal to the index at b. It checks whether or not an element is contracted more then once.

                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        Instances For

                                          The list of indices after contraction or evaluation.

                                          Equations
                                          • One or more equations did not get rendered due to their size.
                                          Instances For

                                            Takes a list and puts consecutive elements into pairs. e.g. [0, 1, 2, 3] becomes [(0, 1), (2, 3)].

                                            Equations
                                            Instances For

                                              Adjusts a list List (ℕ × ℕ) by subtracting from each natural number the number of elements before it in the list which are less than itself. This is used to form a list of pairs which can be used for contracting indices.

                                              Equations
                                              • One or more equations did not get rendered due to their size.
                                              Instances For

                                                Permutations of indices #

                                                Given two lists of indices, all of which are identifiers, returns the List (ℕ) whose ith entry is the position in l2 of the ith index in l1.

                                                Equations
                                                • One or more equations did not get rendered due to their size.
                                                Instances For

                                                  The construction of an expression corresponding to the type of a given string once parsed.

                                                  Equations
                                                  • One or more equations did not get rendered due to their size.
                                                  Instances For

                                                    Syntax for tensor expressions. #

                                                    A syntax category for tensor expressions.

                                                    Equations
                                                    Instances For
                                                      Equations
                                                      • One or more equations did not get rendered due to their size.
                                                      Instances For

                                                        The syntax for a tensor node.

                                                        Equations
                                                        • One or more equations did not get rendered due to their size.
                                                        Instances For

                                                          Equality.

                                                          Equations
                                                          • One or more equations did not get rendered due to their size.
                                                          Instances For

                                                            The syntax for tensor prod two tensor nodes.

                                                            Equations
                                                            • One or more equations did not get rendered due to their size.
                                                            Instances For

                                                              The syntax for tensor addition.

                                                              Equations
                                                              • One or more equations did not get rendered due to their size.
                                                              Instances For

                                                                Allowing brackets to be used in a tensor expression.

                                                                Equations
                                                                • One or more equations did not get rendered due to their size.
                                                                Instances For

                                                                  Scalar multiplication for tensors.

                                                                  Equations
                                                                  • One or more equations did not get rendered due to their size.
                                                                  Instances For

                                                                    group action for tensors.

                                                                    Equations
                                                                    • One or more equations did not get rendered due to their size.
                                                                    Instances For

                                                                      Negation of a tensor tree.

                                                                      Equations
                                                                      • One or more equations did not get rendered due to their size.
                                                                      Instances For

                                                                        Syntax of tensor expressions to indices. #

                                                                        For syntax of the form T where T is Tensor S c this returns the value of TensorSpecies.numIndices T. That is, the exact number of indices associated with that tensor.

                                                                        Equations
                                                                        • One or more equations did not get rendered due to their size.
                                                                        Instances For

                                                                          For syntax of the form T | α β 2 β , getAllIndices returns a list [α, β, 2, β] of all indexExpr.

                                                                          Equations
                                                                          • One or more equations did not get rendered due to their size.
                                                                          Instances For

                                                                            Modifying terms to tensor trees #

                                                                            @[reducible, inline]

                                                                            A Tensor expression operator is a map which takes in a pair consisting of a list of indices and a term and outputs a list of indices and a term, after applying a certain operation.

                                                                            Equations
                                                                            Instances For

                                                                              The creation of a tensor from a syntax tree.

                                                                              Equations
                                                                              • One or more equations did not get rendered due to their size.
                                                                              Instances For

                                                                                The tensor expression operator which rises or lowers the indices of a tensor based on indices with τ-syntax.

                                                                                Equations
                                                                                • One or more equations did not get rendered due to their size.
                                                                                Instances For

                                                                                  The tensor expression operator which evaluates indices.

                                                                                  Equations
                                                                                  • One or more equations did not get rendered due to their size.
                                                                                  Instances For

                                                                                    The tensor expression operator which contracts indices.

                                                                                    Equations
                                                                                    • One or more equations did not get rendered due to their size.
                                                                                    Instances For

                                                                                      The tensor expression operator which takes the product of two tensors.

                                                                                      Equations
                                                                                      Instances For

                                                                                        The tensor expression operator which negates a tensor.

                                                                                        Equations
                                                                                        Instances For

                                                                                          The tensor expression operator which multiplies a tensor by a scalar.

                                                                                          Equations
                                                                                          Instances For

                                                                                            The tensor expression operator which acts on a tensor by a group element.

                                                                                            Equations
                                                                                            Instances For

                                                                                              Whether T1 and T2 elaborate to tensors of definitionally equal colour (equal type). Used to decide whether an identity reindexing between them may be dropped: the bare, un-permT'd term is well typed exactly when the two colours agree by rfl. The check elaborates speculatively and restores the elaborator state afterwards.

                                                                                              Equations
                                                                                              • One or more equations did not get rendered due to their size.
                                                                                              Instances For

                                                                                                Wraps T in the reindexing permT ![lPerm] IsReindexing.auto.

                                                                                                Equations
                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                Instances For

                                                                                                  The tensor expression operator which adds two tensors.

                                                                                                  Equations
                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                  Instances For

                                                                                                    The tensor expression operator which equates two tensors.

                                                                                                    Equations
                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                    Instances For

                                                                                                      Syntax to tensor tree #

                                                                                                      Takes a syntax corresponding to a tensor expression and turns it into a term corresponding to a tensor tree.

                                                                                                      Elaboration #

                                                                                                      Removes redundant Tensorial.toTensor coercions from an elaborated tensor expression: every subterm Tensorial.toTensor t whose Tensorial instance is the canonical instance on S.Tensor c (Tensorial.self) is replaced by t itself, since there the coercion is the identity. Coercions coming from genuine tensorial instances (e.g. on Lorentz vectors) carry real information and are left untouched.

                                                                                                      Equations
                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                      Instances For

                                                                                                        Takes a syntax corresponding to a tensor expression and turns it into an expression corresponding to a tensor tree. The redundant Tensorial.toTensor coercions inserted for bare S.Tensor terms are removed via stripToTensorSelf.

                                                                                                        Equations
                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                        Instances For

                                                                                                          The tensor tree corresponding to a tensor expression.

                                                                                                          Equations
                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                          Instances For

                                                                                                            Test cases #

                                                                                                            We pin the elaboration of the { … }ᵀ notation for each construct it supports: bare tensor nodes, a genuine Tensorial instance, negation, evaluation, scalar multiplication, the group action, products, contractions, addition and equality. Together these check that the elaborator inserts neither a redundant Tensorial.toTensor wrapper on a bare S.Tensor term nor an identity permT when the two sides already align, while keeping the toTensor coercion of a genuine Tensorial instance and a genuine permT for a real reindexing.