AFTD Auto-Formalizing Theoretical Domains

IndexedLOrder.image_erase_eq_erase_image_of_unique

theoremverifiedformalizationimported Lean

IndexedLOrder.image_erase_eq_erase_image_of_unique

Statement

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
open Classical in
variable {T : Type*} [Inhabited T] in
variable {I : Type*} in
variable [IST : IndexedLOrder I T] in
set_option quotPrecheck false in
variable (σ : Finset T) (C : Finset I) in
variable [DecidableEq T] [DecidableEq I] in
open Classical in
variable (c : T → I) (σ : Finset T) (C : Finset I) in
variable {c σ C} in
variable {T I : Type*} [DecidableEq T] [DecidableEq I] in
lemma IndexedLOrder.image_erase_eq_erase_image_of_unique
  (σ : Finset T) (c : T → I) {z : T}
  (_ : z ∈ σ)
  (uniq : ∀ ⦃w⦄, w ∈ σ → c w = c z → w = z) :
  (σ.erase z).image c = (σ.image c).erase (c z)
Formalizes
EconCSLib, `IndexedLOrder.image_erase_eq_erase_image_of_unique`
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 2

Lean source view module on GitHub

set_option autoImplicit true inset_option relaxedAutoImplicit true inopen Classical invariable {T : Type*} [Inhabited T] invariable {I : Type*} invariable [IST : IndexedLOrder I T] inset_option quotPrecheck false invariable (σ : Finset T) (C : Finset I) invariable [DecidableEq T] [DecidableEq I] inopen Classical invariable (c : T → I) (σ : Finset T) (C : Finset I) invariable {c σ C} invariable {T I : Type*} [DecidableEq T] [DecidableEq I] inlemma IndexedLOrder.image_erase_eq_erase_image_of_unique  (σ : Finset T) (c : T → I) {z : T}  (_ : z ∈ σ)  (uniq : ∀ ⦃w⦄, w ∈ σ → c w = c z → w = z) :  (σ.erase z).image c = (σ.image c).erase (c z) := by  ext i  constructor  · intro hi    rcases Finset.mem_image.mp hi with ⟨w, hw_in_erase, rfl⟩    rcases Finset.mem_erase.mp hw_in_erase with ⟨hw_ne_z, hw_in_σ⟩    have h_ne_color : c w ≠ c z := by      intro h_eq      have := uniq hw_in_σ h_eq      exact hw_ne_z this    exact Finset.mem_erase.mpr ⟨h_ne_color, Finset.mem_image.mpr ⟨w, hw_in_σ, rfl⟩⟩  · intro hi    rcases Finset.mem_erase.mp hi with ⟨h_i_ne, hi_img⟩    rcases Finset.mem_image.mp hi_img with ⟨w, hw_in_σ, rfl⟩    have hw_ne_z : w ≠ z := by      intro h_eq      apply h_i_ne      simp [h_eq]    exact Finset.mem_image.mpr ⟨w, Finset.mem_erase.mpr ⟨hw_ne_z, hw_in_σ⟩, rfl⟩
See it in the graphDiscuss this resultChallenge it