TensorSpecies.Tensor.evalAdjustPos
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 evaluating indices.
Statement
set_option autoImplicit true in set_option relaxedAutoImplicit true in open Lean Meta Elab Tactic Term in def TensorSpecies.Tensor.evalAdjustPos (l : List ℕ) : List ℕ
- Defined in
- Physlib, `TensorSpecies.Tensor.evalAdjustPos`
- 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.evalAdjustPos← TensorSpecies.Tensor.evalAdjustPos (Physlib/Relativity/Tensors/Elab.lean:162): 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 evaluating indices. -/ def TensorSpecies.Tensor.evalAdjustPos (l : List ℕ) : List ℕ := let l' := List.mapAccumr (fun x (prev : List ℕ) => let e := prev.countP (fun y => y < x) (x :: prev, x - e)) l.reverse [] l'.2.reverse