fact
stringlengths
19
8.26k
type
stringclasses
8 values
library
stringclasses
2 values
imports
listlengths
0
7
filename
stringclasses
397 values
symbolic_name
stringlengths
1
73
docstring
stringlengths
20
499
equivCons {n m : ℕ} (e : Fin n ≃ Fin m) : Fin n.succ ≃ Fin m.succ where toFun := Fin.cons 0 (Fin.succ ∘ e.toFun) invFun := Fin.cons 0 (Fin.succ ∘ e.invFun) left_inv i := by rcases Fin.eq_zero_or_eq_succ i with hi | hi · simp [hi] · obtain ⟨j, hj⟩ := hi simp [hj] right_inv i := by rcases Fin.eq_zero_or_eq_succ i with hi...
def
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
equivCons
/-- Given an equivalence between `Fin n` and `Fin m`, the induced equivalence between `Fin n.succ` and `Fin m.succ` derived by `Fin.cons`. -/
equivCons_zero {n m : ℕ} (e : Fin n ≃ Fin m) : equivCons e 0 = 0 := by simp [equivCons] @[simp]
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
equivCons_zero
null
equivCons_trans {n m k : ℕ} (e : Fin n ≃ Fin m) (f : Fin m ≃ Fin k) : Fin.equivCons (e.trans f) = (Fin.equivCons e).trans (Fin.equivCons f) := by refine Equiv.ext_iff.mpr fun x ↦ ?_ simp only [Nat.succ_eq_add_one, equivCons, Equiv.toFun_as_coe, Equiv.coe_trans, Equiv.invFun_as_coe, Equiv.coe_fn_mk, Equiv.trans_apply] m...
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
equivCons_trans
null
equivCons_castOrderIso {n m : ℕ} (h : n = m) : (Fin.equivCons (Fin.castOrderIso h).toEquiv) = (Fin.castOrderIso (by simp [h])).toEquiv := by refine Equiv.ext_iff.mpr fun x ↦ ?_ simp only [Nat.succ_eq_add_one, equivCons, Equiv.toFun_as_coe, RelIso.coe_fn_toEquiv, Equiv.invFun_as_coe, Equiv.coe_fn_mk, Fin.castOrderIso_ap...
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
equivCons_castOrderIso
null
equivCons_symm_succ {n m : ℕ} (e : Fin n ≃ Fin m) (i : ℕ) (hi : i + 1 < m.succ) : (Fin.equivCons e).symm ⟨i + 1, hi⟩ = (e.symm ⟨i, Nat.succ_lt_succ_iff.mp hi⟩).succ := by simp only [Nat.succ_eq_add_one, equivCons, Equiv.toFun_as_coe, Equiv.invFun_as_coe, Equiv.coe_fn_symm_mk] have hi : ⟨i + 1, hi⟩ = Fin.succ ⟨i, Nat.su...
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
equivCons_symm_succ
null
equivCons_succ {n m : ℕ} (e : Fin n ≃ Fin m) (i : ℕ) (hi : i + 1 < n.succ) : (Fin.equivCons e) ⟨i + 1, hi⟩ = (e ⟨i, Nat.succ_lt_succ_iff.mp hi⟩).succ := by simp only [Nat.succ_eq_add_one, equivCons, Equiv.toFun_as_coe, Equiv.invFun_as_coe] have hi : ⟨i + 1, hi⟩ = Fin.succ ⟨i, Nat.succ_lt_succ_iff.mp hi⟩ := by rfl simp ...
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Tactic.Linarith", "import Mathlib.Logic.Equiv.Fin.Basic" ]
PhysLean/Mathematics/Fin.lean
equivCons_succ
null
HomogeneousQuadratic (V : Type) [AddCommMonoid V] [Module ℚ V] : Type := V →ₑ[((fun a => a ^ 2) : ℚ → ℚ)] ℚ namespace HomogeneousQuadratic variable {V : Type} [AddCommMonoid V] [Module ℚ V] /-- A homogeneous quadratic equation can be treated as a function from `V` to `ℚ`. -/
def
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
HomogeneousQuadratic
/-- The structure defining a homogeneous quadratic equation. -/
instFun : FunLike (HomogeneousQuadratic V) V ℚ where coe f := f.toFun coe_injective' f g h := by cases f cases g simp_all
instance
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
instFun
/-- A homogeneous quadratic equation can be treated as a function from `V` to `ℚ`. -/
map_smul (f : HomogeneousQuadratic V) (a : ℚ) (S : V) : f (a • S) = a ^ 2 * f S := f.map_smul' a S
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
map_smul
/-- A homogeneous quadratic equation can be treated as a function from `V` to `ℚ`. -/
BiLinearSymm (V : Type) [AddCommMonoid V] [Module ℚ V] extends V →ₗ[ℚ] V →ₗ[ℚ] ℚ where swap' : ∀ S T, toFun S T = toFun T S /-- A symmetric bilinear function. -/
structure
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
BiLinearSymm
/-- The structure of a symmetric bilinear function. -/
IsSymmetric {V : Type} [AddCommMonoid V] [Module ℚ V] (f : V →ₗ[ℚ] V →ₗ[ℚ] ℚ) : Prop where swap : ∀ S T, f S T = f T S namespace BiLinearSymm open BigOperators variable {V : Type} [AddCommMonoid V] [Module ℚ V] /-- A symmetric bilinear form can be treated as a function from `V` to `V →ₗ[ℚ] ℚ`. -/
class
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
IsSymmetric
/-- A symmetric bilinear function. -/
instFun (V : Type) [AddCommMonoid V] [Module ℚ V] : FunLike (BiLinearSymm V) V (V →ₗ[ℚ] ℚ) where coe f := f.toFun coe_injective' f g h := by cases f cases g simp_all /-- The construction of a symmetric bilinear map from `smul` and `map_add` in the first factor, and swap. -/ @[simps!]
instance
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
instFun
/-- A symmetric bilinear form can be treated as a function from `V` to `V →ₗ[ℚ] ℚ`. -/
mk₂ (f : V × V → ℚ) (map_smul : ∀ a S T, f (a • S, T) = a * f (S, T)) (map_add : ∀ S1 S2 T, f (S1 + S2, T) = f (S1, T) + f (S2, T)) (swap : ∀ S T, f (S, T) = f (T, S)) : BiLinearSymm V where toFun := fun S => { toFun := fun T => f (S, T) map_add' := by intro T1 T2 rw [swap, map_add] simp [swap] map_smul' := by intro a ...
def
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
mk₂
/-- The construction of a symmetric bilinear map from `smul` and `map_add` in the first factor, and swap. -/
map_smul₁ (f : BiLinearSymm V) (a : ℚ) (S T : V) : f (a • S) T = a * f S T := by have h : f (a • S) = a • (f S) := by exact f.map_smul a S simp [h]
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
map_smul₁
null
swap (f : BiLinearSymm V) (S T : V) : f S T = f T S := f.swap' S T
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
swap
null
map_smul₂ (f : BiLinearSymm V) (a : ℚ) (S : V) (T : V) : f S (a • T) = a * f S T := by rw [f.swap, f.map_smul₁, f.swap]
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
map_smul₂
null
map_add₁ (f : BiLinearSymm V) (S1 S2 T : V) : f (S1 + S2) T = f S1 T + f S2 T := by have h : f (S1 + S2) = f S1 + f S2 := by exact f.map_add S1 S2 simp [h]
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
map_add₁
null
map_add₂ (f : BiLinearSymm V) (S : V) (T1 T2 : V) : f S (T1 + T2) = f S T1 + f S T2 := by rw [f.swap, f.map_add₁, f.swap T1 S, f.swap T2 S] /-- Fixing the second input vectors, the resulting linear map. -/
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
map_add₂
null
toLinear₁ (f : BiLinearSymm V) (T : V) : V →ₗ[ℚ] ℚ where toFun S := f S T map_add' S1 S2 := map_add₁ f S1 S2 T map_smul' a S := by simp [f.map_smul₁]
def
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
toLinear₁
/-- Fixing the second input vectors, the resulting linear map. -/
toLinear₁_apply (f : BiLinearSymm V) (S T : V) : f S T = f.toLinear₁ T S := rfl
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
toLinear₁_apply
/-- Fixing the second input vectors, the resulting linear map. -/
map_sum₁ {n : ℕ} (f : BiLinearSymm V) (S : Fin n → V) (T : V) : f (∑ i, S i) T = ∑ i, f (S i) T := by simp [f.toLinear₁_apply, map_sum]
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
map_sum₁
/-- Fixing the second input vectors, the resulting linear map. -/
map_sum₂ {n : ℕ} (f : BiLinearSymm V) (S : Fin n → V) (T : V) : f T (∑ i, S i) = ∑ i, f T (S i) := map_sum (f T) S Finset.univ /-- The homogeneous quadratic equation obtainable from a bilinear function. -/ @[simps!]
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
map_sum₂
/-- Fixing the second input vectors, the resulting linear map. -/
toHomogeneousQuad {V : Type} [AddCommMonoid V] [Module ℚ V] (τ : BiLinearSymm V) : HomogeneousQuadratic V where toFun S := τ S S map_smul' a S := by simp only [τ.map_smul₁, τ.map_smul₂, smul_eq_mul] grind
def
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
toHomogeneousQuad
/-- The homogeneous quadratic equation obtainable from a bilinear function. -/
toHomogeneousQuad_add {V : Type} [AddCommMonoid V] [Module ℚ V] (τ : BiLinearSymm V) (S T : V) : τ.toHomogeneousQuad (S + T) = τ.toHomogeneousQuad S + τ.toHomogeneousQuad T + 2 * τ S T := by simp only [HomogeneousQuadratic, toHomogeneousQuad_apply, τ.map_add₁, map_add, τ.swap T S] grind
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
toHomogeneousQuad_add
/-- The homogeneous quadratic equation obtainable from a bilinear function. -/
HomogeneousCubic (V : Type) [AddCommMonoid V] [Module ℚ V] : Type := V →ₑ[((fun a => a ^ 3) : ℚ → ℚ)] ℚ namespace HomogeneousCubic variable {V : Type} [AddCommMonoid V] [Module ℚ V] /-- A homogeneous cubic equation can be treated as a function from `V` to `ℚ`. -/
def
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
HomogeneousCubic
/-- The structure of a homogeneous cubic equation. -/
instFun : FunLike (HomogeneousCubic V) V ℚ where coe f := f.toFun coe_injective' f g h := by cases f cases g simp_all
instance
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
instFun
/-- A homogeneous cubic equation can be treated as a function from `V` to `ℚ`. -/
map_smul (f : HomogeneousCubic V) (a : ℚ) (S : V) : f (a • S) = a ^ 3 * f S := f.map_smul' a S
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
map_smul
/-- A homogeneous cubic equation can be treated as a function from `V` to `ℚ`. -/
TriLinearSymm (V : Type) [AddCommMonoid V] [Module ℚ V] extends V →ₗ[ℚ] V →ₗ[ℚ] V →ₗ[ℚ] ℚ where swap₁' : ∀ S T L, toFun S T L = toFun T S L swap₂' : ∀ S T L, toFun S T L = toFun S L T namespace TriLinearSymm open BigOperators variable {V : Type} [AddCommMonoid V] [Module ℚ V] /-- A symmetric trilinear form can be treat...
structure
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
TriLinearSymm
/-- The structure of a symmetric trilinear function. -/
instFun : FunLike (TriLinearSymm V) V (V →ₗ[ℚ] V →ₗ[ℚ] ℚ) where coe f := f.toFun coe_injective' f g h := by cases f cases g simp_all /-- The construction of a symmetric trilinear map from `smul` and `map_add` in the first factor, and two swap. -/ @[simps!]
instance
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
instFun
/-- A symmetric trilinear form can be treated as a function from `V` to `V →ₗ[ℚ] V →ₗ[ℚ] ℚ`. -/
mk₃ (f : V × V × V→ ℚ) (map_smul : ∀ a S T L, f (a • S, T, L) = a * f (S, T, L)) (map_add : ∀ S1 S2 T L, f (S1 + S2, T, L) = f (S1, T, L) + f (S2, T, L)) (swap₁ : ∀ S T L, f (S, T, L) = f (T, S, L)) (swap₂ : ∀ S T L, f (S, T, L) = f (S, L, T)) : TriLinearSymm V where toFun := fun S => (BiLinearSymm.mk₂ (fun T => f (S, ...
def
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
mk₃
/-- The construction of a symmetric trilinear map from `smul` and `map_add` in the first factor, and two swap. -/
swap₁ (f : TriLinearSymm V) (S T L : V) : f S T L = f T S L := f.swap₁' S T L
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
swap₁
null
swap₂ (f : TriLinearSymm V) (S T L : V) : f S T L = f S L T := f.swap₂' S T L
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
swap₂
null
swap₃ (f : TriLinearSymm V) (S T L : V) : f S T L = f L T S := by rw [f.swap₁, f.swap₂, f.swap₁]
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
swap₃
null
map_smul₁ (f : TriLinearSymm V) (a : ℚ) (S T L : V) : f (a • S) T L = a * f S T L := by have h : f (a • S) = a • (f S) := by exact f.map_smul a S simp [h]
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
map_smul₁
null
map_smul₂ (f : TriLinearSymm V) (S : V) (a : ℚ) (T L : V) : f S (a • T) L = a * f S T L := by rw [f.swap₁, f.map_smul₁, f.swap₁]
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
map_smul₂
null
map_smul₃ (f : TriLinearSymm V) (S T : V) (a : ℚ) (L : V) : f S T (a • L) = a * f S T L := by rw [f.swap₃, f.map_smul₁, f.swap₃]
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
map_smul₃
null
map_add₁ (f : TriLinearSymm V) (S1 S2 T L : V) : f (S1 + S2) T L = f S1 T L + f S2 T L := by have h : f (S1 + S2) = f S1 + f S2 := by exact f.map_add S1 S2 simp [h]
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
map_add₁
null
map_add₂ (f : TriLinearSymm V) (S T1 T2 L : V) : f S (T1 + T2) L = f S T1 L + f S T2 L := by rw [f.swap₁, f.map_add₁, f.swap₁ S T1, f.swap₁ S T2]
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
map_add₂
null
map_add₃ (f : TriLinearSymm V) (S T L1 L2 : V) : f S T (L1 + L2) = f S T L1 + f S T L2 := by rw [f.swap₃, f.map_add₁, f.swap₃, f.swap₃ L2 T S] /-- Fixing the second and third input vectors, the resulting linear map. -/
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
map_add₃
null
toLinear₁ (f : TriLinearSymm V) (T L : V) : V →ₗ[ℚ] ℚ where toFun S := f S T L map_add' S1 S2 := map_add₁ f S1 S2 T L map_smul' a S := by simp only [f.map_smul₁] rfl
def
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
toLinear₁
/-- Fixing the second and third input vectors, the resulting linear map. -/
toLinear₁_apply (f : TriLinearSymm V) (S T L : V) : f S T L = f.toLinear₁ T L S := rfl
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
toLinear₁_apply
/-- Fixing the second and third input vectors, the resulting linear map. -/
map_sum₁ {n : ℕ} (f : TriLinearSymm V) (S : Fin n → V) (T : V) (L : V) : f (∑ i, S i) T L = ∑ i, f (S i) T L := by rw [f.toLinear₁_apply, map_sum] rfl
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
map_sum₁
/-- Fixing the second and third input vectors, the resulting linear map. -/
map_sum₂ {n : ℕ} (f : TriLinearSymm V) (S : Fin n → V) (T : V) (L : V) : f T (∑ i, S i) L = ∑ i, f T (S i) L := by rw [swap₁, map_sum₁] refine Fintype.sum_congr _ _ fun _ ↦ swap₁ f (S _) T L
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
map_sum₂
null
map_sum₃ {n : ℕ} (f : TriLinearSymm V) (S : Fin n → V) (T : V) (L : V) : f T L (∑ i, S i) = ∑ i, f T L (S i) := map_sum ((f T) L) S Finset.univ
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
map_sum₃
null
map_sum₁₂₃ {n1 n2 n3 : ℕ} (f : TriLinearSymm V) (S : Fin n1 → V) (T : Fin n2 → V) (L : Fin n3 → V) : f (∑ i, S i) (∑ i, T i) (∑ i, L i) = ∑ i, ∑ k, ∑ l, f (S i) (T k) (L l) := by rw [map_sum₁] apply Fintype.sum_congr _ _ fun _ ↦ ?_ rw [map_sum₂] exact Fintype.sum_congr _ _ fun _ ↦ map_sum₃ f L (S _) (T _) /-- The homog...
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
map_sum₁₂₃
null
toCubic {charges : Type} [AddCommMonoid charges] [Module ℚ charges] (τ : TriLinearSymm charges) : HomogeneousCubic charges where toFun S := τ S S S map_smul' a S := by simp only [smul_eq_mul] rw [τ.map_smul₁, τ.map_smul₂, τ.map_smul₃] grind
def
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
toCubic
/-- The homogeneous cubic equation obtainable from a symmetric trilinear function. -/
toCubic_add {charges : Type} [AddCommMonoid charges] [Module ℚ charges] (τ : TriLinearSymm charges) (S T : charges) : τ.toCubic (S + T) = τ.toCubic S + τ.toCubic T + 3 * τ S S T + 3 * τ T T S := by simp only [HomogeneousCubic, toCubic_apply] rw [τ.map_add₁, τ.map_add₂, τ.map_add₂, τ.map_add₃, τ.map_add₃, τ.map_add₃, τ....
lemma
PhysLean
[ "import Mathlib.Tactic.Polyrith", "import Mathlib.Algebra.Module.LinearMap.Defs", "import Mathlib.Data.Fintype.BigOperators", "import PhysLean.Meta.TODO.Basic", "import Mathlib.Algebra.Ring.Rat" ]
PhysLean/Mathematics/LinearMaps.lean
toCubic_add
/-- The homogeneous cubic equation obtainable from a symmetric trilinear function. -/
takeWile_eraseIdx {I : Type} (P : I → Prop) [DecidablePred P] : (l : List I) → (i : ℕ) → (hi : ∀ (i j : Fin l.length), i < j → P (l.get j) → P (l.get i)) → List.takeWhile P (List.eraseIdx l i) = (List.takeWhile P l).eraseIdx i | [], _, h => by rfl | a :: [], 0, h => by simp only [List.takeWhile, List.eraseIdx_zero] spl...
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
takeWile_eraseIdx
null
dropWile_eraseIdx {I : Type} (P : I → Prop) [DecidablePred P] : (l : List I) → (i : ℕ) → (hi : ∀ (i j : Fin l.length), i < j → P (l.get j) → P (l.get i)) → List.dropWhile P (List.eraseIdx l i) = if (List.takeWhile P l).length ≤ i then (List.dropWhile P l).eraseIdx (i - (List.takeWhile P l).length) else (List.dropWhile ...
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
dropWile_eraseIdx
null
insertionSort_length {I : Type} (le1 : I → I → Prop) [DecidableRel le1] (l : List I) : (List.insertionSort le1 l).length = l.length := List.Perm.length_eq (List.perm_insertionSort le1 l) /-- The position `r0` ends up in `r` on adding it via `List.orderedInsert _ r0 r`. -/
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
insertionSort_length
null
orderedInsertPos {I : Type} (le1 : I → I → Prop) [DecidableRel le1] (r : List I) (r0 : I) : Fin (List.orderedInsert le1 r0 r).length := ⟨(List.takeWhile (fun b => decide ¬ le1 r0 b) r).length, by rw [List.orderedInsert_length] have h1 : (List.takeWhile (fun b => decide ¬le1 r0 b) r).length ≤ r.length := List.Sublist.le...
def
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
orderedInsertPos
/-- The position `r0` ends up in `r` on adding it via `List.orderedInsert _ r0 r`. -/
orderedInsertPos_lt_length {I : Type} (le1 : I → I → Prop) [DecidableRel le1] (r : List I) (r0 : I) : orderedInsertPos le1 r r0 < (r0 :: r).length := by simp only [orderedInsertPos, List.length_cons] have h1 : (List.takeWhile (fun b => decide ¬le1 r0 b) r).length ≤ r.length := List.Sublist.length_le (List.takeWhile_sub...
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
orderedInsertPos_lt_length
/-- The position `r0` ends up in `r` on adding it via `List.orderedInsert _ r0 r`. -/
orderedInsert_get_orderedInsertPos {I : Type} (le1 : I → I → Prop) [DecidableRel le1] (r : List I) (r0 : I) : (List.orderedInsert le1 r0 r)[(orderedInsertPos le1 r r0).val] = r0 := by simp [List.orderedInsert_eq_take_drop, orderedInsertPos] @[simp]
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
orderedInsert_get_orderedInsertPos
null
orderedInsert_eraseIdx_orderedInsertPos {I : Type} (le1 : I → I → Prop) [DecidableRel le1] (r : List I) (r0 : I) : (List.orderedInsert le1 r0 r).eraseIdx ↑(orderedInsertPos le1 r r0) = r := by simp only [List.orderedInsert_eq_take_drop] rw [List.eraseIdx_append_of_length_le] · simp [orderedInsertPos] · rfl
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
orderedInsert_eraseIdx_orderedInsertPos
null
orderedInsertPos_cons {I : Type} (le1 : I → I → Prop) [DecidableRel le1] (r : List I) (r0 r1 : I) : (orderedInsertPos le1 (r1 ::r) r0).val = if le1 r0 r1 then ⟨0, by simp⟩ else (Fin.succ (orderedInsertPos le1 r r0)) := by simp only [List.orderedInsert.eq_2, orderedInsertPos, List.takeWhile, decide_not, Fin.zero_eta, Fi...
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
orderedInsertPos_cons
null
orderedInsertPos_sigma {I : Type} {f : I → Type} (le1 : I → I → Prop) [DecidableRel le1] (l : List (Σ i, f i)) (k : I) (a : f k) : (orderedInsertPos (fun (i j : Σ i, f i) => le1 i.1 j.1) l ⟨k, a⟩).1 = (orderedInsertPos le1 (List.map (fun (i : Σ i, f i) => i.1) l) k).1 := by simp only [orderedInsertPos, decide_not] indu...
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
orderedInsertPos_sigma
null
orderedInsert_get_lt {I : Type} (le1 : I → I → Prop) [DecidableRel le1] (r : List I) (r0 : I) (i : ℕ) (hi : i < orderedInsertPos le1 r r0) : (List.orderedInsert le1 r0 r)[i] = r.get ⟨i, by simp only [orderedInsertPos] at hi have h1 : (List.takeWhile (fun b => decide ¬le1 r0 b) r).length ≤ r.length := List.Sublist.lengt...
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
orderedInsert_get_lt
null
orderedInsertPos_take_orderedInsert {I : Type} (le1 : I → I → Prop) [DecidableRel le1] (r : List I) (r0 : I) : (List.take (orderedInsertPos le1 r r0) (List.orderedInsert le1 r0 r)) = List.takeWhile (fun b => decide ¬le1 r0 b) r := by simp [orderedInsertPos, List.orderedInsert_eq_take_drop]
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
orderedInsertPos_take_orderedInsert
null
orderedInsertPos_take_eq_orderedInsert {I : Type} (le1 : I → I → Prop) [DecidableRel le1] (r : List I) (r0 : I) : List.take (orderedInsertPos le1 r r0) r = List.take (orderedInsertPos le1 r r0) (List.orderedInsert le1 r0 r) := by refine List.ext_get ?_ ?_ · simp only [List.length_take, Fin.is_le', inf_of_le_left, inf_e...
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
orderedInsertPos_take_eq_orderedInsert
null
orderedInsertPos_drop_eq_orderedInsert {I : Type} (le1 : I → I → Prop) [DecidableRel le1] (r : List I) (r0 : I) : List.drop (orderedInsertPos le1 r r0) r = List.drop (orderedInsertPos le1 r r0).succ (List.orderedInsert le1 r0 r) := by conv_rhs => simp [orderedInsertPos, List.orderedInsert_eq_take_drop] have hr : r = Li...
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
orderedInsertPos_drop_eq_orderedInsert
null
orderedInsertPos_take {I : Type} (le1 : I → I → Prop) [DecidableRel le1] (r : List I) (r0 : I) : List.take (orderedInsertPos le1 r r0) r = List.takeWhile (fun b => decide ¬le1 r0 b) r := by rw [orderedInsertPos_take_eq_orderedInsert,orderedInsertPos_take_orderedInsert]
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
orderedInsertPos_take
null
orderedInsertPos_drop {I : Type} (le1 : I → I → Prop) [DecidableRel le1] (r : List I) (r0 : I) : List.drop (orderedInsertPos le1 r r0) r = List.dropWhile (fun b => decide ¬le1 r0 b) r := by rw [orderedInsertPos_drop_eq_orderedInsert] simp [orderedInsertPos, List.orderedInsert_eq_take_drop]
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
orderedInsertPos_drop
null
orderedInsertPos_succ_take_orderedInsert {I : Type} (le1 : I → I → Prop) [DecidableRel le1] (r : List I) (r0 : I) : (List.take (orderedInsertPos le1 r r0).succ (List.orderedInsert le1 r0 r)) = List.takeWhile (fun b => decide ¬le1 r0 b) r ++ [r0] := by simp [orderedInsertPos, List.orderedInsert_eq_take_drop, List.take_a...
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
orderedInsertPos_succ_take_orderedInsert
null
lt_orderedInsertPos_rel {I : Type} (le1 : I → I → Prop) [DecidableRel le1] (r0 : I) (r : List I) (n : Fin r.length) (hn : n.val < (orderedInsertPos le1 r r0).val) : ¬ le1 r0 (r.get n) := by have htake : r.get n ∈ List.take (orderedInsertPos le1 r r0) r := by rw [@List.mem_take_iff_getElem] use n simp only [List.get_eq_...
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
lt_orderedInsertPos_rel
null
lt_orderedInsertPos_rel_fin {I : Type} (le1 : I → I → Prop) [DecidableRel le1] (r0 : I) (r : List I) (n : Fin (List.orderedInsert le1 r0 r).length) (hn : n < (orderedInsertPos le1 r r0)) : ¬ le1 r0 ((List.orderedInsert le1 r0 r).get n) := by have htake : (List.orderedInsert le1 r0 r).get n ∈ List.take (orderedInsertPos...
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
lt_orderedInsertPos_rel_fin
null
gt_orderedInsertPos_rel {I : Type} (le1 : I → I → Prop) [DecidableRel le1] [IsTotal I le1] [IsTrans I le1] (r0 : I) (r : List I) (hs : List.Pairwise le1 r) (n : Fin r.length) (hn : ¬ n.val < (orderedInsertPos le1 r r0).val) : le1 r0 (r.get n) := by have hrsSorted : List.Pairwise le1 (List.orderedInsert le1 r0 r) := Lis...
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
gt_orderedInsertPos_rel
null
orderedInsert_eraseIdx_lt_orderedInsertPos {I : Type} (le1 : I → I → Prop) [DecidableRel le1] (r : List I) (r0 : I) (i : ℕ) (hi : i < orderedInsertPos le1 r r0) (hr : ∀ (i j : Fin r.length), i < j → ¬le1 r0 (r.get j) → ¬le1 r0 (r.get i)) : (List.orderedInsert le1 r0 r).eraseIdx i = List.orderedInsert le1 r0 (r.eraseIdx...
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
orderedInsert_eraseIdx_lt_orderedInsertPos
null
orderedInsert_eraseIdx_orderedInsertPos_le {I : Type} (le1 : I → I → Prop) [DecidableRel le1] (r : List I) (r0 : I) (i : ℕ) (hi : orderedInsertPos le1 r r0 ≤ i) (hr : ∀ (i j : Fin r.length), i < j → ¬le1 r0 (r.get j) → ¬le1 r0 (r.get i)) : (List.orderedInsert le1 r0 r).eraseIdx (Nat.succ i) = List.orderedInsert le1 r0 ...
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
orderedInsert_eraseIdx_orderedInsertPos_le
null
orderedInsertEquiv {I : Type} (le1 : I → I → Prop) [DecidableRel le1] (r : List I) (r0 : I) : Fin (r.length + 1) ≃ Fin (List.orderedInsert le1 r0 r).length := by let e2 : Fin (List.orderedInsert le1 r0 r).length ≃ Fin (r0 :: r).length := (Fin.castOrderIso (List.orderedInsert_length le1 r r0)).toEquiv let e3 : Fin (r0 :...
def
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
orderedInsertEquiv
/-- The equivalence between `Fin (r0 :: r).length` and `Fin (List.orderedInsert le1 r0 r).length` according to where the elements map, i.e. `0` is taken to `orderedInsertPos le1 r r0`. -/
orderedInsertEquiv_zero {I : Type} (le1 : I → I → Prop) [DecidableRel le1] (r : List I) (r0 : I) : orderedInsertEquiv le1 r r0 0 = orderedInsertPos le1 r r0 := by simp [orderedInsertEquiv]
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
orderedInsertEquiv_zero
null
orderedInsertEquiv_succ {I : Type} (le1 : I → I → Prop) [DecidableRel le1] (r : List I) (r0 : I) (n : ℕ) (hn : Nat.succ n < (r0 :: r).length) : orderedInsertEquiv le1 r r0 ⟨Nat.succ n, hn⟩ = Fin.cast (List.orderedInsert_length le1 r r0).symm ((Fin.succAbove ⟨(orderedInsertPos le1 r r0), orderedInsertPos_lt_length le1 r...
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
orderedInsertEquiv_succ
null
orderedInsertEquiv_fin_succ {I : Type} (le1 : I → I → Prop) [DecidableRel le1] (r : List I) (r0 : I) (n : Fin r.length) : orderedInsertEquiv le1 r r0 n.succ = Fin.cast (List.orderedInsert_length le1 r r0).symm ((Fin.succAbove ⟨(orderedInsertPos le1 r r0), orderedInsertPos_lt_length le1 r r0⟩) ⟨n, n.isLt⟩) := by simp on...
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
orderedInsertEquiv_fin_succ
null
orderedInsertEquiv_monotone_fin_succ {I : Type} (le1 : I → I → Prop) [DecidableRel le1] (r : List I) (r0 : I) (n m : Fin r.length) (hx : orderedInsertEquiv le1 r r0 n.succ < orderedInsertEquiv le1 r r0 m.succ) : n < m := by rw [orderedInsertEquiv_fin_succ, orderedInsertEquiv_fin_succ, Fin.lt_def] at hx simp only [Fin.e...
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
orderedInsertEquiv_monotone_fin_succ
null
orderedInsertEquiv_congr {α : Type} {r : α → α → Prop} [DecidableRel r] (a : α) (l l' : List α) (h : l = l') : orderedInsertEquiv r l a = (Fin.castOrderIso (by simp [h])).toEquiv.trans ((orderedInsertEquiv r l' a).trans (Fin.castOrderIso (by simp [h])).toEquiv) := by subst h rfl
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
orderedInsertEquiv_congr
null
get_eq_orderedInsertEquiv {I : Type} (le1 : I → I → Prop) [DecidableRel le1] (r : List I) (r0 : I) : (r0 :: r).get = (List.orderedInsert le1 r0 r).get ∘ (orderedInsertEquiv le1 r r0) := by funext x match x with | ⟨0, h⟩ => simp | ⟨Nat.succ n, h⟩ => simp only [List.length_cons, Nat.succ_eq_add_one, List.get_eq_getElem, ...
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
get_eq_orderedInsertEquiv
null
orderedInsertEquiv_get {I : Type} (le1 : I → I → Prop) [DecidableRel le1] (r : List I) (r0 : I) : (r0 :: r).get ∘ (orderedInsertEquiv le1 r r0).symm = (List.orderedInsert le1 r0 r).get := by rw [get_eq_orderedInsertEquiv le1] funext x simp
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
orderedInsertEquiv_get
null
orderedInsert_eraseIdx_orderedInsertEquiv_zero {I : Type} (le1 : I → I → Prop) [DecidableRel le1] (r : List I) (r0 : I) : (List.orderedInsert le1 r0 r).eraseIdx (orderedInsertEquiv le1 r r0 ⟨0, by simp⟩) = r := by simp [orderedInsertEquiv]
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
orderedInsert_eraseIdx_orderedInsertEquiv_zero
null
orderedInsert_eraseIdx_orderedInsertEquiv_succ {I : Type} (le1 : I → I → Prop) [DecidableRel le1] (r : List I) (r0 : I) (n : ℕ) (hn : Nat.succ n < (r0 :: r).length) (hr : ∀ (i j : Fin r.length), i < j → ¬le1 r0 (r.get j) → ¬le1 r0 (r.get i)) : (List.orderedInsert le1 r0 r).eraseIdx (orderedInsertEquiv le1 r r0 ⟨Nat.suc...
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
orderedInsert_eraseIdx_orderedInsertEquiv_succ
null
orderedInsert_eraseIdx_orderedInsertEquiv_fin_succ {I : Type} (le1 : I → I → Prop) [DecidableRel le1] (r : List I) (r0 : I) (n : Fin r.length) (hr : ∀ (i j : Fin r.length), i < j → ¬le1 r0 (r.get j) → ¬le1 r0 (r.get i)) : (List.orderedInsert le1 r0 r).eraseIdx (orderedInsertEquiv le1 r r0 n.succ) = (List.orderedInsert ...
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
orderedInsert_eraseIdx_orderedInsertEquiv_fin_succ
null
orderedInsertEquiv_sigma {I : Type} {f : I → Type} (le1 : I → I → Prop) [DecidableRel le1] (l : List (Σ i, f i)) (i : I) (a : f i) : (orderedInsertEquiv (fun i j => le1 i.fst j.fst) l ⟨i, a⟩) = (Fin.castOrderIso (by simp)).toEquiv.trans ((orderedInsertEquiv le1 (List.map (fun i => i.1) l) i).trans (Fin.castOrderIso (by...
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
orderedInsertEquiv_sigma
null
orderedInsert_eq_insertIdx_orderedInsertPos {I : Type} (le1 : I → I → Prop) [DecidableRel le1] (r : List I) (r0 : I) : List.orderedInsert le1 r0 r = List.insertIdx r (orderedInsertPos le1 r r0).1 r0 := by apply List.ext_get · simp only [List.orderedInsert_length] rw [List.length_insertIdx] have h1 := orderedInsertPos_l...
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
orderedInsert_eq_insertIdx_orderedInsertPos
null
insertionSortEquiv {α : Type} (r : α → α → Prop) [DecidableRel r] : (l : List α) → Fin l.length ≃ Fin (List.insertionSort r l).length | [] => Equiv.refl _ | a :: l => (Fin.equivCons (insertionSortEquiv r l)).trans (orderedInsertEquiv r (List.insertionSort r l) a)
def
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
insertionSortEquiv
/-- The equivalence between `Fin l.length ≃ Fin (List.insertionSort r l).length` induced by the sorting algorithm. -/
insertionSortEquiv_get {α : Type} {r : α → α → Prop} [DecidableRel r] : (l : List α) → l.get ∘ (insertionSortEquiv r l).symm = (List.insertionSort r l).get | [] => by rfl | a :: l => by rw [insertionSortEquiv] change ((a :: l).get ∘ ((Fin.equivCons (insertionSortEquiv r l))).symm) ∘ (orderedInsertEquiv r (List.insertio...
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
insertionSortEquiv_get
/-- The equivalence between `Fin l.length ≃ Fin (List.insertionSort r l).length` induced by the sorting algorithm. -/
insertionSortEquiv_congr {α : Type} {r : α → α → Prop} [DecidableRel r] (l l' : List α) (h : l = l') : insertionSortEquiv r l = (Fin.castOrderIso (by simp [h])).toEquiv.trans ((insertionSortEquiv r l').trans (Fin.castOrderIso (by simp [h])).toEquiv) := by subst h rfl
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
insertionSortEquiv_congr
null
insertionSortEquiv_congr_apply {α : Type} {r : α → α → Prop} [DecidableRel r] (l l' : List α) (h : l = l') (i : Fin l.length) : insertionSortEquiv r l i = Fin.cast (by simp [h]) ((insertionSortEquiv r l') (Fin.cast (by simp [h]) i)) := by rw [insertionSortEquiv_congr l l' h] simp
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
insertionSortEquiv_congr_apply
null
insertionSort_get_comp_insertionSortEquiv {α : Type} {r : α → α → Prop} [DecidableRel r] (l : List α) : (List.insertionSort r l).get ∘ (insertionSortEquiv r l) = l.get := by rw [← insertionSortEquiv_get] funext x simp
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
insertionSort_get_comp_insertionSortEquiv
null
insertionSort_eq_ofFn {α : Type} {r : α → α → Prop} [DecidableRel r] (l : List α) : List.insertionSort r l = List.ofFn (l.get ∘ (insertionSortEquiv r l).symm) := by rw [insertionSortEquiv_get (r := r)] exact (List.ofFn_get (List.insertionSort r l)).symm
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
insertionSort_eq_ofFn
null
insertionSortEquiv_order {α : Type} {r : α → α → Prop} [DecidableRel r] : (l : List α) → (i : Fin l.length) → (j : Fin l.length) → (hij : i < j) → (hij' : insertionSortEquiv r l j < insertionSortEquiv r l i) → ¬ r l[i] l[j] | [], i, _, _, _ => Fin.elim0 i | a :: as, ⟨0, hi⟩, ⟨j + 1, hj⟩, hij, hij' => by simp only [List...
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
insertionSortEquiv_order
null
optionErase {I : Type} (l : List I) (i : Option (Fin l.length)) : List I := match i with | none => l | some i => List.eraseIdx l i
def
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
optionErase
/-- Optional erase of an element in a list. For `none` returns the list, for `some i` returns the list with the `i`'th element erased. -/
eraseIdx_length' {I : Type} (l : List I) (i : Fin l.length) : (List.eraseIdx l i).length = l.length - 1 := by simp [List.length_eraseIdx]
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
eraseIdx_length'
/-- Optional erase of an element in a list. For `none` returns the list, for `some i` returns the list with the `i`'th element erased. -/
eraseIdx_length {I : Type} (l : List I) (i : Fin l.length) : (List.eraseIdx l i).length + 1 = l.length := by simp only [List.length_eraseIdx, Fin.is_lt, ↓reduceIte] have hi := i.prop omega
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
eraseIdx_length
/-- Optional erase of an element in a list. For `none` returns the list, for `some i` returns the list with the `i`'th element erased. -/
eraseIdx_length_succ {I : Type} (l : List I) (i : Fin l.length) : (List.eraseIdx l i).length.succ = l.length := by simp only [List.length_eraseIdx, Fin.is_lt, ↓reduceIte] have hi := i.prop omega
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
eraseIdx_length_succ
null
eraseIdx_cons_length {I : Type} (a : I) (l : List I) (i : Fin (a :: l).length) : (List.eraseIdx (a :: l) i).length= l.length := by simp [List.length_eraseIdx]
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
eraseIdx_cons_length
null
eraseIdx_get {I : Type} (l : List I) (i : Fin l.length) : (List.eraseIdx l i).get = l.get ∘ (Fin.cast (eraseIdx_length l i)) ∘ (Fin.cast (eraseIdx_length l i).symm i).succAbove := by ext x simp only [Function.comp_apply, List.get_eq_getElem, List.getElem_eraseIdx] simp only [Fin.succAbove, Fin.coe_cast] by_cases hi: x....
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
eraseIdx_get
null
eraseIdx_insertionSort {I : Type} (le1 : I → I → Prop) [DecidableRel le1] [IsTotal I le1] [IsTrans I le1] : (n : ℕ) → (r : List I) → (hn : n < r.length) → (List.insertionSort le1 r).eraseIdx ↑((insertionSortEquiv le1 r) ⟨n, hn⟩) = List.insertionSort le1 (r.eraseIdx n) | 0, [], _ => by rfl | 0, (r0 :: r), hn => by simp ...
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
eraseIdx_insertionSort
null
eraseIdx_insertionSort_fin {I : Type} (le1 : I → I → Prop) [DecidableRel le1] [IsTotal I le1] [IsTrans I le1] (r : List I) (n : Fin r.length) : (List.insertionSort le1 r).eraseIdx ↑((PhysLean.List.insertionSortEquiv le1 r) n) = List.insertionSort le1 (r.eraseIdx n) := eraseIdx_insertionSort le1 n.val r (Fin.prop n) /--...
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
eraseIdx_insertionSort_fin
null
insertionSortMinPos {α : Type} (r : α → α → Prop) [DecidableRel r] (i : α) (l : List α) : Fin (i :: l).length := (insertionSortEquiv r (i :: l)).symm ⟨0, by rw [insertionSort_length] exact Nat.zero_lt_succ l.length⟩ /-- The element of `i :: l` at `insertionSortMinPos`. -/
def
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
insertionSortMinPos
/-- Given a list `i :: l` the left-most minimal position `a` of `i :: l` wrt `r`. That is the first position of `l` such that for every element `(i :: l)[b]` before that position `r ((i :: l)[b]) ((i :: l)[a])` is not true. The use of `i :: l` here rather then just `l` is to ensure that such a position exists. ...
insertionSortMin {α : Type} (r : α → α → Prop) [DecidableRel r] (i : α) (l : List α) : α := (i :: l).get (insertionSortMinPos r i l)
def
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
insertionSortMin
/-- The element of `i :: l` at `insertionSortMinPos`. -/
insertionSortMin_eq_insertionSort_head {α : Type} (r : α → α → Prop) [DecidableRel r] (i : α) (l : List α) : insertionSortMin r i l = (List.insertionSort r (i :: l)).head (by refine List.ne_nil_of_length_pos ?_ rw [insertionSort_length] exact Nat.zero_lt_succ l.length) := by trans (List.insertionSort r (i :: l)).get (⟨...
lemma
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
insertionSortMin_eq_insertionSort_head
/-- The element of `i :: l` at `insertionSortMinPos`. -/
insertionSortDropMinPos {α : Type} (r : α → α → Prop) [DecidableRel r] (i : α) (l : List α) : List α := (i :: l).eraseIdx (insertionSortMinPos r i l)
def
PhysLean
[ "import PhysLean.Mathematics.Fin", "import Mathlib.Data.Nat.Lattice" ]
PhysLean/Mathematics/List.lean
insertionSortDropMinPos
/-- The list remaining after dropping the element at the position determined by `insertionSortMinPos`. -/