Physlib.List.take_insert_let
theoremverifiedformalizationimported Lean
Physlib.List.take_insert_let
Statement
set_option autoImplicit true in set_option relaxedAutoImplicit true in variable {n : Nat} in lemma Physlib.List.take_insert_let {I : Type} (i : I) : (n m : ℕ) → (h : m ≤ n) → (r : List I) → (hm : m ≤ r.length) → (List.take (n + 1) (List.insertIdx r m i)).Perm (i :: List.take n r)
- Formalizes
- Physlib, `Physlib.List.take_insert_let`
- Lean proof
- By Joseph Tooby-Smith, from github.com/leanprover-community/physlib at
e411c6e89692(Copyright (c) 2024 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.Physlib.List.take_insert_let← Physlib.List.take_insert_let (Physlib/Mathematics/ForMathlib/List/InsertIdx.lean:181): verbatim
- Verified
- 09 Oct 2026
- Axioms
propext- Used by 1
- FieldStatistic.ofList_insert_lt_eqFieldStatistic.ofList_insert_lt_eq
Lean source view module on GitHub
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
set_option autoImplicit true inset_option relaxedAutoImplicit true invariable {n : Nat} inlemma Physlib.List.take_insert_let {I : Type} (i : I) : (n m : ℕ) → (h : m ≤ n) → (r : List I) → (hm : m ≤ r.length) → (List.take (n + 1) (List.insertIdx r m i)).Perm (i :: List.take n r) | 0, 0, h, _, _ => by simp | m + 1, 0, h, r, _ => by simp | n + 1, m + 1, h, [], hm => by simp at hm | n + 1, m + 1, h, a::as, hm => by simp only [List.insertIdx_succ_cons, List.take_succ_cons] have hp : (i :: a :: List.take n as).Perm (a :: i :: List.take n as) := by exact List.Perm.swap a i (List.take n as) refine List.Perm.trans ?_ hp.symm refine List.Perm.cons a ?_ exact take_insert_let i n m (Nat.le_of_succ_le_succ h) as (Nat.le_of_succ_le_succ hm)