TensorSpecies.Tensor.contrListAdjust
defimported Lean
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.
Statement
set_option autoImplicit true in set_option relaxedAutoImplicit true in open Lean Meta Elab Tactic Term in def TensorSpecies.Tensor.contrListAdjust (l : List (ℕ × ℕ)) : List (ℕ × ℕ)
- Defined in
- Physlib, `TensorSpecies.Tensor.contrListAdjust`
- Lean proof
- By Joseph Tooby-Smith, from github.com/leanprover-community/physlib at
e411c6e89692(Copyright (c) 2025 Joseph Tooby-Smith. All rights reserved, Apache-2.0). Compiled here against leanprover/lean4:v4.33.1, Mathlib v4.33.1; written for leanprover/lean4:v4.34.1.TensorSpecies.Tensor.contrListAdjust← TensorSpecies.Tensor.contrListAdjust (Physlib/Relativity/Tensors/Elab.lean:265): verbatim
- Verified
- 10 Oct 2026
- Axioms
- none listed
Lean source view module on GitHub
set_option autoImplicit true in set_option relaxedAutoImplicit true in open Lean Meta Elab Tactic Term in /-- 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. -/ def TensorSpecies.Tensor.contrListAdjust (l : List (ℕ × ℕ)) : List (ℕ × ℕ) := (l.mapAccumr (fun (x : ℕ × ℕ) (prev : List ℕ) => (x.1 :: x.2 :: prev, (x.1 - prev.countP (fun y => y < x.1), x.2 - prev.countP (fun y => y < x.2)))) []).2