AFTD Auto-Formalizing Theoretical Domains

EconCSLib.LinearAlgebra.liftCert_weighted_sum_swap

theoremverifiedformalizationimported Lean

Inner-product-of-lift: ∑ i, liftCert u' i * g i = ∑ idx, u'(idx) * fmRow_at idx g, where the fmRow_at value depends on g and idx. The lemma uses Finset.sum_comm to swap sums and Finset.sum_ite_eq' to evaluate the indicators. Specialised forms (liftCert_weighted_A_castSucc, liftCert_weighted_A_last, liftCert_weighted_b) recognise the inner sum as fmA/0/fmB.

Statement

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
open Finset BigOperators in
set_option linter.unusedSectionVars false in
variable {𝕜 : Type*} [Field 𝕜] [LinearOrder 𝕜] [IsStrictOrderedRing 𝕜] in
variable {I : Type*} [Fintype I] [DecidableEq I] {n : ℕ} in
theorem EconCSLib.LinearAlgebra.liftCert_weighted_sum_swap (A : I → Fin (n+1) → 𝕜)
    (u' : FMRowIndex A → 𝕜) (g : I → 𝕜) :
    ∑ i, liftCert A u' i * g i
    = ∑ idx, u' idx * (∑ i, liftCoeff A idx i * g i)
Formalizes
EconCSLib, `EconCSLib.LinearAlgebra.liftCert_weighted_sum_swap`
Lean proof
By xbei (from the file's git history), from github.com/gametheoryinlean/EconCSLib at 1a88f809b538 (Copyright (c) 2026 EconCSLib contributors. All rights reserved, Apache-2.0). Compiled here against leanprover/lean4:v4.33.1, Mathlib v4.33.1; written for leanprover/lean4:v4.30.0.
Verified
08 Oct 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 10
Used by 3

Lean source view module on GitHub

set_option autoImplicit true inset_option relaxedAutoImplicit true inopen Finset BigOperators inset_option linter.unusedSectionVars false invariable {𝕜 : Type*} [Field 𝕜] [LinearOrder 𝕜] [IsStrictOrderedRing 𝕜] invariable {I : Type*} [Fintype I] [DecidableEq I] {n : ℕ} in/-- Inner-product-of-lift: `∑ i, liftCert u' i * g i = ∑ idx, u'(idx) * fmRow_at idx g`, where the `fmRow_at` value depends on `g` and `idx`. The lemma uses `Finset.sum_comm` to swap sums and `Finset.sum_ite_eq'` to evaluate the indicators. Specialised forms (`liftCert_weighted_A_castSucc`, `liftCert_weighted_A_last`, `liftCert_weighted_b`) recognise the inner sum as `fmA`/`0`/`fmB`. -/theorem EconCSLib.LinearAlgebra.liftCert_weighted_sum_swap (A : I → Fin (n+1) → 𝕜)    (u' : FMRowIndex A → 𝕜) (g : I → 𝕜) :    ∑ i, liftCert A u' i * g i    = ∑ idx, u' idx * (∑ i, liftCoeff A idx i * g i) := by  unfold liftCert  -- ∑ i, (∑ idx, L idx i * u' idx) * g i  --   = ∑ i, ∑ idx, L idx i * u' idx * g i  --   = ∑ idx, ∑ i, L idx i * u' idx * g i  --   = ∑ idx, u' idx * (∑ i, L idx i * g i)  rw [show (∑ i, (∑ idx, liftCoeff A idx i * u' idx) * g i)      = ∑ i, ∑ idx, liftCoeff A idx i * u' idx * g i from ?_,      Finset.sum_comm]  · refine Finset.sum_congr rfl ?_    intro idx _    rw [Finset.mul_sum]    refine Finset.sum_congr rfl ?_    intro i _    ring  · refine Finset.sum_congr rfl ?_    intro i _    rw [Finset.sum_mul]
See it in the graphDiscuss this resultChallenge it