TensorSpecies.Tensor.toPairs
defimported Lean
Takes a list and puts consecutive elements into pairs. e.g. [0, 1, 2, 3] becomes [(0, 1), (2, 3)].
Statement
set_option autoImplicit true in set_option relaxedAutoImplicit true in open Lean Meta Elab Tactic Term in def TensorSpecies.Tensor.toPairs (l : List ℕ) : List (ℕ × ℕ)
- Defined in
- Physlib, `TensorSpecies.Tensor.toPairs`
- 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.toPairs← TensorSpecies.Tensor.toPairs (Physlib/Relativity/Tensors/Elab.lean:256): 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 /-- Takes a list and puts consecutive elements into pairs. e.g. [0, 1, 2, 3] becomes [(0, 1), (2, 3)]. -/ def TensorSpecies.Tensor.toPairs (l : List ℕ) : List (ℕ × ℕ) := match l with | x1 :: x2 :: xs => (x1, x2) :: toPairs xs | [] => [] | [x] => [(x, 0)]