Documentation

Physlib.Relativity.Tensors.Reindexing

Reindexing of tensor components #

In this file we give results related to the reindexing of tensors. If a tensor has indices specified by a list of colors c : Fin n → C, then reindexing the tensor corresponds to a bijection σ : Fin m → Fin n such that c ∘ σ = c1 for some other list of colors c1 : Fin m → C. A reindexing might take a tensor ψⁱⱼ to a tensor ψʲᵢ by reordering the indices, or it might take a tensor ψⁱⱼᵏ to a tensor ψⁱᵏ.

We are interested in the interaction of reindexing with the following operations on tensors:

Index maps #

The finite index maps out of which the reindexings below are built: Fin.append for products and Fin.succAbove for a deleted slot. The lemmas on Fin.succSuccAbove, for a deleted pair, are in Physlib.Relativity.Tensors.Contraction.SuccSuccAbove.

Splitting Fin (m + n) into its two blocks and reassembling them is the identity.

theorem Fin.append_succAbove_const_eq_cycleIcc {n : ℕ} (i : Fin (n + 1)) :
(append i.succAbove fun (x : Fin 1) => i) = ⇑(i.cycleIcc (last n))

Moving slot i to the end is the cycle [i, last]: the block map that lists the i.succAbove survivors in order and then i is Fin.cycleIcc i (Fin.last n).

def TensorSpecies.Tensor.IsReindexing {C : Type} {n m : ℕ} (c : Fin n → C) (c1 : Fin m → C) (σ : Fin m → Fin n) :

Given two lists of indices c : Fin n → C and c1 : Fin m → C a map σ : Fin m → Fin n satisfies the condition IsReindexing c c1 σ if it is:

  • A bijection
  • Forms a commutative triangle with c and c1.
Equations
Instances For

    Properties of the underlying function #

    theorem TensorSpecies.Tensor.IsReindexing.injective {C : Type} {n m : ℕ} {c : Fin n → C} {c1 : Fin m → C} {σ : Fin m → Fin n} (h : IsReindexing c c1 σ) :
    theorem TensorSpecies.Tensor.IsReindexing.surjective {C : Type} {n m : ℕ} {c : Fin n → C} {c1 : Fin m → C} {σ : Fin m → Fin n} (h : IsReindexing c c1 σ) :
    theorem TensorSpecies.Tensor.IsReindexing.auto {C : Type} {n m : ℕ} {c : Fin n → C} {c1 : Fin m → C} {σ : Fin m → Fin n} (h : IsReindexing c c1 σ := by { simp [IsReindexing]; try decide }) :
    IsReindexing c c1 σ
    @[simp]
    theorem TensorSpecies.Tensor.IsReindexing.on_id {C : Type} {n : ℕ} {c c1 : Fin n → C} :
    IsReindexing c c1 id ↔ ∀ (i : Fin n), c i = c1 i
    theorem TensorSpecies.Tensor.IsReindexing.on_id_symm {C : Type} {n : ℕ} {c c1 : Fin n → C} (h : IsReindexing c1 c id) :
    def TensorSpecies.Tensor.IsReindexing.inv {C : Type} {n m : ℕ} {c : Fin n → C} {c1 : Fin m → C} (σ : Fin m → Fin n) (h : IsReindexing c c1 σ) :
    Fin n → Fin m

    For a map σ satisfying IsReindexing c c1 σ, the inverse of that map.

    Equations
    Instances For
      def TensorSpecies.Tensor.IsReindexing.toEquiv {C : Type} {n m : ℕ} {c : Fin n → C} {c1 : Fin m → C} {σ : Fin m → Fin n} (h : IsReindexing c c1 σ) :
      Fin n ≃ Fin m

      For a map σ : Fin m → Fin n satisfying IsReindexing c c1 σ, that map lifted to an equivalence between Fin n and Fin m.

      Equations
      Instances For
        theorem TensorSpecies.Tensor.IsReindexing.apply_inv_apply {C : Type} {n m : ℕ} {c : Fin n → C} {c1 : Fin m → C} (σ : Fin m → Fin n) (h : IsReindexing c c1 σ) (x : Fin m) :
        inv σ h (σ x) = x
        theorem TensorSpecies.Tensor.IsReindexing.inv_apply_apply {C : Type} {n m : ℕ} {c : Fin n → C} {c1 : Fin m → C} (σ : Fin m → Fin n) (h : IsReindexing c c1 σ) (x : Fin n) :
        σ (inv σ h x) = x
        theorem TensorSpecies.Tensor.IsReindexing.swap_of_eq {C : Type} {c c1 : Fin 2 → C} (h0 : c 1 = c1 0) (h1 : c 0 = c1 1) :

        The swap ![1, 0] reindexes two rank-two colour lists whose colours match crosswise; swap with the target colours given by equations.

        theorem TensorSpecies.Tensor.IsReindexing.inv_eq_self_of_pointwise_eq {C : Type} {n : ℕ} {c c1 : Fin n → C} {σ : Fin n → Fin n} (h : IsReindexing c c1 σ) (hσ : ∀ (x : Fin n), σ x = x) (x : Fin n) :
        inv σ h x = x
        theorem TensorSpecies.Tensor.IsReindexing.inv_id_eq {C : Type} {n : ℕ} {c c1 : Fin n → C} (h : IsReindexing c c1 id) (x : Fin n) :
        inv id h x = x
        theorem TensorSpecies.Tensor.IsReindexing.inv_cast_eq {C : Type} {n m : ℕ} {c : Fin n → C} {c1 : Fin m → C} (e : m = n) (h : IsReindexing c c1 (Fin.cast e)) (x : Fin n) :
        inv (Fin.cast e) h x = Fin.cast ⋯ x
        theorem TensorSpecies.Tensor.IsReindexing.inv_equiv_symm_eq {C : Type} {n : ℕ} {c c1 : Fin n → C} (e : Equiv.Perm (Fin n)) (h : IsReindexing c c1 ⇑(Equiv.symm e)) (x : Fin n) :
        inv (⇑(Equiv.symm e)) h x = e x
        theorem TensorSpecies.Tensor.IsReindexing.preserve_color {C : Type} {n m : ℕ} {c : Fin n → C} {c1 : Fin m → C} {σ : Fin m → Fin n} (h : IsReindexing c c1 σ) (x : Fin m) :
        c1 x = (c ∘ σ) x
        @[simp]
        theorem TensorSpecies.Tensor.IsReindexing.inv_perserve_color {C : Type} {n m : ℕ} {c : Fin n → C} {c1 : Fin m → C} {σ : Fin m → Fin n} (h : IsReindexing c c1 σ) (x : Fin n) :
        c1 (inv σ h x) = c x
        @[simp]
        theorem TensorSpecies.Tensor.IsReindexing.toEquiv_symm_perserve_color {C : Type} {n m : ℕ} {c : Fin n → C} {c1 : Fin m → C} {σ : Fin m → Fin n} (h : IsReindexing c c1 σ) (x : Fin m) :
        c (h.toEquiv.symm x) = c1 x

        Constructors #

        theorem TensorSpecies.Tensor.IsReindexing.swap {C : Type} {n : ℕ} {c : Fin n → C} (i j : Fin n) :
        IsReindexing c (c ∘ ⇑(Equiv.swap i j)) ⇑(Equiv.swap i j)
        theorem TensorSpecies.Tensor.IsReindexing.symm {C : Type} {n m : ℕ} {c : Fin n → C} {c1 : Fin m → C} {σ : Fin m → Fin n} (h : IsReindexing c c1 σ) :
        IsReindexing c1 c (inv σ h)

        The inverse of a map satisfying IsReindexing c c1 σ is a reindexing of c1 by c.

        theorem TensorSpecies.Tensor.IsReindexing.symm_of_id {C : Type} {n : ℕ} {c c1 : Fin n → C} (h : IsReindexing c c1 id) :
        theorem TensorSpecies.Tensor.IsReindexing.comp {C : Type} {n n1 n2 : ℕ} {c : Fin n → C} {c1 : Fin n1 → C} {c2 : Fin n2 → C} {σ : Fin n1 → Fin n} {σ2 : Fin n2 → Fin n1} (h : IsReindexing c c1 σ) (h2 : IsReindexing c1 c2 σ2) :
        IsReindexing c c2 (σ ∘ σ2)

        The composition of two maps satisfying IsReindexing also satisfies the IsReindexing.

        theorem TensorSpecies.Tensor.IsReindexing.append_congr_left {C : Type} {n n' n2 : ℕ} {c : Fin n → C} {c' : Fin n' → C} {σ : Fin n' → Fin n} (c2 : Fin n2 → C) (h : IsReindexing c c' σ) :
        theorem TensorSpecies.Tensor.IsReindexing.append_congr_right {C : Type} {n n' n2 : ℕ} {c : Fin n → C} {c' : Fin n' → C} {σ : Fin n' → Fin n} (c2 : Fin n2 → C) (h : IsReindexing c c' σ) :
        theorem TensorSpecies.Tensor.IsReindexing.append_zero_right {C : Type} {n : ℕ} {c : Fin n → C} {c1 : Fin 0 → C} :
        theorem TensorSpecies.Tensor.IsReindexing.append_swap {C : Type} {n n2 : ℕ} {c : Fin n → C} {c2 : Fin n2 → C} :
        theorem TensorSpecies.Tensor.IsReindexing.append_assoc_right {C : Type} {n1 n2 n3 : ℕ} {c : Fin n1 → C} {c2 : Fin n2 → C} {c3 : Fin n3 → C} :
        theorem TensorSpecies.Tensor.IsReindexing.append_assoc_left {C : Type} {n1 n2 n3 : ℕ} {c : Fin n1 → C} {c2 : Fin n2 → C} {c3 : Fin n3 → C} :
        theorem TensorSpecies.Tensor.IsReindexing.append_succAbove_natAdd {C : Type} {n n1 : ℕ} {c : Fin n → C} {c1 : Fin (n1 + 1) → C} (i : Fin (n1 + 1)) :
        theorem TensorSpecies.Tensor.IsReindexing.append_succAbove_castAdd {C : Type} {n n1 : ℕ} {c : Fin (n + 1) → C} {c1 : Fin (n1 + 1) → C} (i : Fin (n + 1)) :
        theorem TensorSpecies.Tensor.IsReindexing.append_succSuccAbove_natAdd {C : Type} {n n1 : ℕ} {c : Fin (n + 1 + 1) → C} {c1 : Fin n1 → C} (i j : Fin (n + 1 + 1)) :

        Removing two entries from the right component of Fin.append c1 c commutes with the append: removing the i-th and j-th entries of c and then appending c1 matches removing the corresponding entries of Fin.append c1 c, via the identity permutation. This is used for the commutation of taking a product of tensors with contraction of indices.

        theorem TensorSpecies.Tensor.IsReindexing.succAbove_of_eq_zero {C : Type} {n n1 : ℕ} {c : Fin (n + 1) → C} {c1 : Fin (n1 + 1) → C} {σ : Fin (n1 + 1) → Fin (n + 1)} (i : Fin (n1 + 1)) (h : IsReindexing c c1 σ) (hi : σ i = 0) :
        IsReindexing (c ∘ Fin.succ) (c1 ∘ i.succAbove) fun (j : Fin n1) => (σ (i.succAbove j)).pred ⋯

        Given a reindexing of c by c1 via σ for which the index i is sent to 0, removing the i-th entry of c1 and the first entry of c yields a reindexing of c ∘ Fin.succ by c1 ∘ i.succAbove via the map sending j to the predecessor of σ (i.succAbove j).

        theorem TensorSpecies.Tensor.IsReindexing.succAbove_of_neq_zero {C : Type} {n n1 : ℕ} {c : Fin (n + 1) → C} {c1 : Fin (n1 + 1) → C} {σ : Fin (n1 + 1) → Fin (n + 1)} (i : Fin (n1 + 1)) (h : IsReindexing c c1 σ) (hi : σ i ≠ 0) :
        IsReindexing (c ∘ (σ i).succAbove) (c1 ∘ i.succAbove) (((σ i).pred hi).predAbove ∘ σ ∘ i.succAbove)

        Given a reindexing of c by c1 via σ for which the index i is not sent to 0, removing the i-th entry of c1 and the (σ i)-th entry of c yields a reindexing of c ∘ (σ i).succAbove by c1 ∘ i.succAbove via the map (σ i).pred.predAbove ∘ σ ∘ i.succAbove.

        theorem TensorSpecies.Tensor.IsReindexing.succAbove {C : Type} {n n1 : ℕ} {c : Fin (n + 1) → C} {c1 : Fin (n1 + 1) → C} {σ : Fin (n1 + 1) → Fin (n + 1)} (i : Fin (n1 + 1)) (h : IsReindexing c c1 σ) :
        IsReindexing (c ∘ (σ i).succAbove) (c1 ∘ i.succAbove) (if hi : σ i = 0 then fun (j : Fin n1) => (σ (i.succAbove j)).pred ⋯ else ((σ i).pred hi).predAbove ∘ σ ∘ i.succAbove)

        Given a reindexing of c by c1 via σ, removing the i-th entry of c1 and the (σ i)-th entry of c yields a reindexing of c ∘ (σ i).succAbove by c1 ∘ i.succAbove. This unifies succAbove_of_eq_zero and succAbove_of_neq_zero via a case split on whether σ i = 0. This is used for the commutation of permutation of indices with evaluation of indices.

        theorem TensorSpecies.Tensor.IsReindexing.succAbove_of_succAbove_eq {C : Type} {n : ℕ} {c c1 : Fin (n + 1) → C} {σ : Fin (n + 1) → Fin (n + 1)} {σ' : Fin n → Fin n} (i : Fin (n + 1)) (h : IsReindexing c c1 σ) (hσ' : (σ i).succAbove ∘ σ' = σ ∘ i.succAbove) :
        IsReindexing (c ∘ (σ i).succAbove) (c1 ∘ i.succAbove) σ'

        The conclusion of succAbove from an explicit survivor relabelling: if σ' fills the square (σ i).succAbove ∘ σ' = σ ∘ i.succAbove, carrying the complement of i to the complement of σ i, then it is a reindexing of the two shortened colour lists. The square forces σ' to be injective, hence bijective, so no bijectivity hypothesis is needed; this is why the statement is restricted to equal lengths.

        Where succAbove builds the relabelling from σ as a dite composite, the map here is the caller's, which is what lets it stand in the statement of a lemma the caller instantiates.

        theorem TensorSpecies.Tensor.IsReindexing.succSuccAbove {C : Type} {n n1 : ℕ} {c : Fin (n + 1 + 1) → C} {c1 : Fin (n1 + 1 + 1) → C} (i j : Fin (n1 + 1 + 1)) (hij : i ≠ j) {σ : Fin (n1 + 1 + 1) → Fin (n + 1 + 1)} (hσ : IsReindexing c c1 σ) :
        IsReindexing (c ∘ (σ i).succSuccAbove (σ j)) (c1 ∘ i.succSuccAbove j) (i.funPredPredAbove j hij σ ⋯)

        Given a reindexing of c by c1 via σ and two distinct indices i ≠ j, removing the i-th and j-th entries of c1 and the (σ i)-th and (σ j)-th entries of c yields a reindexing of c ∘ (σ i).succSuccAbove (σ j) by c1 ∘ i.succSuccAbove j. This is used for the commutation of permutation of indices with contraction of indices.

        theorem TensorSpecies.Tensor.IsReindexing.succSuccAbove_comm {C : Type} {n : ℕ} {c : Fin (n + 1 + 1 + 1 + 1) → C} (i1 j1 : Fin (n + 1 + 1 + 1 + 1)) (i2 j2 : Fin (n + 1 + 1)) (hij1 : i1 ≠ j1) (hij2 : i2 ≠ j2) :
        let i2' := i1.succSuccAbove j1 i2; let j2' := i1.succSuccAbove j1 j2; have hi2j2' := ⋯; have i1' := i2'.predPredAbove j2' hi2j2' i1 ⋯; have j1' := i2'.predPredAbove j2' hi2j2' j1 ⋯; IsReindexing ((c ∘ i2'.succSuccAbove j2') ∘ i1'.succSuccAbove j1') ((c ∘ i1.succSuccAbove j1) ∘ i2.succSuccAbove j2) id

        Removing two pairs of entries from c in either order gives the same colour list: removing the i1-th and j1-th entries and then the (shifted) i2-th and j2-th entries matches removing the i2-th and j2-th entries first and then the (shifted) i1-th and j1-th entries, via the identity permutation. This is used for the commutation of two contractions.

        theorem TensorSpecies.Tensor.IsReindexing.succAbove_succSuccAbove_comm {C : Type} {n : ℕ} {c : Fin (n + 1 + 1 + 1) → C} (k : Fin (n + 1 + 1 + 1)) (i j : Fin (n + 1 + 1)) (hij : i ≠ j) :
        let i' := k.succAbove i; let j' := k.succAbove j; have hij' := ⋯; have k' := i'.predPredAbove j' hij' k ⋯; IsReindexing ((c ∘ i'.succSuccAbove j') ∘ k'.succAbove) ((c ∘ k.succAbove) ∘ i.succSuccAbove j) id

        Removing one entry and then a pair of entries from c in either order gives the same colour list: removing the k-th entry and then the (shifted) i-th and j-th entries matches removing the i-th and j-th entries first and then the (shifted) k-th entry, via the identity permutation. This is used for the commutation of a contraction with an evaluation.

        theorem TensorSpecies.Tensor.IsReindexing.succSuccAbove_succAbove_comm {C : Type} {n : ℕ} {c : Fin (n + 1 + 1 + 1) → C} (k : Fin (n + 1)) (i j : Fin (n + 1 + 1 + 1)) :
        have k' := i.succSuccAbove j k; have k'' := Fin.predAbove 0 k'; have i' := k''.predAbove i; have j' := k''.predAbove j; IsReindexing ((c ∘ k'.succAbove) ∘ i'.succSuccAbove j') ((c ∘ i.succSuccAbove j) ∘ k.succAbove) id
        theorem TensorSpecies.Tensor.IsReindexing.succAbove_succAbove_comm {C : Type} {n : ℕ} {c : Fin (n + 1 + 1) → C} (k1 : Fin (n + 1 + 1)) (k2 : Fin (n + 1)) :
        have k2' := k1.succAbove k2; have k1' := k2.predAbove k1; IsReindexing ((c ∘ k2'.succAbove) ∘ k1'.succAbove) ((c ∘ k1.succAbove) ∘ k2.succAbove) id

        Removing two single entries from c in either order gives the same colour list: removing the k1-th entry and then the (shifted) k2-th entry matches removing the k2-th entry first and then the (shifted) k1-th entry, via the identity permutation. This is used for the commutation of two evaluations of indices.

        Splitting a list of colours c : Fin (n + 1) → C into its first n entries and its last entry recovers c: the identity permutation matches Fin.append (c ∘ (Fin.last n).succAbove) ![c (Fin.last n)] with c.

        theorem TensorSpecies.Tensor.IsReindexing.move_last {C : Type} {n : ℕ} {c : Fin (n + 1) → C} {c1 : Fin 2 → C} (i : Fin (n + 1)) (hc : c i = c1 1) :

        Splitting a list of colours c : Fin (n + 1) → C at an arbitrary slot i, rather than at the last one as in append_succ_last: the block map that lists the i.succAbove survivors and then i itself matches c with the survivors of i followed by the surviving entry c1 1 of a rank-two list c1 whose second entry is slot i's colour.

        theorem TensorSpecies.Tensor.IsReindexing.update_update_of_eq {C : Type} {n : ℕ} {c : Fin n → C} {d e : C} (i : Fin n) (he : c i = e) :

        Updating slot i of c to d and then back to e = c i returns c, no other slot moving: the colour cast a round trip of two contractions at slot i generates.

        Splitting a list of colours c : Fin (n + 1) → C into its first entry and its remaining n entries recovers c: the canonical reindexing Fin (1 + n) ≃ Fin (n + 1) matches Fin.append ![c 0] (c ∘ Fin.succAbove 0) with c.

        theorem TensorSpecies.Tensor.IsReindexing.fin_cast_isReindexing {C : Type} (n n1 : ℕ) {c : Fin n → C} (h : n1 = n) :

        Casting the domain along an equality n1 = n of lengths is a reindexing of c by c ∘ Fin.cast h.