AFTD Auto-Formalizing Theoretical Domains

project_embed_id

theoremverifiedformalizationimported Lean

project_to_product ∘ embed_from_product = id.

Statement

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
open Filter in
variable {I : Type*} [Fintype I] [DecidableEq I] [Inhabited I] [LinearOrder I] (card : I → ℕ+) in
lemma project_embed_id (y : ProductSimplices card) :
  project_to_product card (embed_from_product card y) = y
Formalizes
EconCSLib, `project_embed_id`
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 14
  • index_splitSplit a flat index k into its block/index pair (i, j).
  • embed_from_productEmbedding of the product of simplices into the big simplex.
  • index_split_combine_inverseindex_split is a left inverse to index_combine.
  • ProductSimplicesThe product of simplices indexed by I.
  • project_to_productRetraction from the big simplex to the product of simplices.
  • blockSumSum of coordinates of x over the block i.
  • blockWeightWeight (size fraction) of block i: (card i) / (total_card card).
  • total_cardTotal number of coordinates: the sum of card i over all i.
  • BigSimplexThe big simplex on total_card card coordinates.
  • index_combineCombine a block/index pair (i, j) back into a flat index.
  • deficitTotal positive shortfall of block sums relative to block weights.
  • tPushAmount to push x toward z_uniform (always in [0, 1]).
  • pushTowardsZConvex push of x toward z_uniform by amount tPush.
  • z_uniformThe uniform point in the big simplex.

Lean source view module on GitHub

set_option autoImplicit true inset_option relaxedAutoImplicit true inopen Filter invariable {I : Type*} [Fintype I] [DecidableEq I] [Inhabited I] [LinearOrder I] (card : I → ℕ+) in/-- `project_to_product ∘ embed_from_product = id`. -/lemma project_embed_id (y : ProductSimplices card) :  project_to_product card (embed_from_product card y) = y := by  classical  have h_blockSum : ∀ i, blockSum card i (embed_from_product card y) = blockWeight card i := by    intro i    have :        blockSum card i (embed_from_product card y) =          (((∑ j : Fin (card i), (y i).1 j) * (card i : ℝ)) / (total_card card : ℝ)) := by      classical      have hsum :          (∑ j : Fin (card i), (embed_from_product card y).1 (index_combine card ⟨i, j⟩)) =            (∑ j : Fin (card i), (y i).1 j * (card i : ℝ) / (total_card card : ℝ)) := by        refine Finset.sum_congr rfl ?_;        intro j _        simpa [embed_from_product] using          congrArg            (fun p : Σ i, Fin (card i) =>              (y p.1).1 p.2 * (card p.1 : ℝ) / (total_card card : ℝ))            (index_split_combine_inverse card ⟨i, j⟩)      simpa [blockSum, Finset.sum_div, Finset.sum_mul] using hsum    simpa [blockWeight, (y i).2.2, one_mul] using this  have h_deficit_zero : deficit card (embed_from_product card y) = 0 := by    simp [deficit, h_blockSum]  have h_tPush_zero : tPush card (embed_from_product card y) = 0 := by    simp [tPush, h_deficit_zero]  have h_push_id : pushTowardsZ card (embed_from_product card y) = embed_from_product card y := by    apply Subtype.ext    funext k    simp [pushTowardsZ, h_tPush_zero]  funext i  apply Subtype.ext  funext j  have h_denom :      blockSum card i (pushTowardsZ card (embed_from_product card y)) = blockWeight card i := by    simpa [h_push_id] using h_blockSum i  have h_bw_pos : 0 < blockWeight card i := by    unfold blockWeight    have htc : 0 < (total_card card : ℝ) := by      norm_cast; exact PNat.pos (total_card card)    have hci : 0 < (card i : ℝ) := by      norm_cast; exact PNat.pos (card i)    exact div_pos hci htc  have h_norm_eq_div :      ((project_to_product card (embed_from_product card y)) i).1 j =        ((embed_from_product card y).1 (index_combine card ⟨i, j⟩)) / (blockWeight card i) := by    simp [project_to_product, h_push_id]    rw [h_blockSum i]  have h_div_cancel :      ((embed_from_product card y).1 (index_combine card ⟨i, j⟩)) / (blockWeight card i) =        (y i).1 j := by    have hnum : (embed_from_product card y).1 (index_combine card ⟨i, j⟩) =        (y i).1 j * (card i : ℝ) / (total_card card : ℝ) := by      simpa [embed_from_product] using        congrArg          (fun p : Σ i, Fin (card i) =>            (y p.1).1 p.2 * (card p.1 : ℝ) / (total_card card : ℝ))          (index_split_combine_inverse card ⟨i, j⟩)    have hbw_ne : blockWeight card i ≠ 0 := ne_of_gt h_bw_pos    have htc : (total_card card : ℝ) ≠ 0 := by      have : 0 < (total_card card : ℝ) := by        norm_cast; exact PNat.pos (total_card card)      exact ne_of_gt this    have hci : (card i : ℝ) ≠ 0 := by      have : 0 < (card i : ℝ) := by        norm_cast; exact PNat.pos (card i)      exact ne_of_gt this    have :        ((y i).1 j * (card i : ℝ) / (total_card card : ℝ)) /            ((card i : ℝ) / (total_card card : ℝ)) =          (y i).1 j := by      field_simp [hci, htc]    simpa [hnum, blockWeight] using this  simpa [h_norm_eq_div] using h_div_cancel
See it in the graphDiscuss this resultChallenge it