AFTD Auto-Formalizing Theoretical Domains

weighted_uncovered_step_invariance

theoremverifiedformalization

For any finite type of voters V and candidate type C with decidable equality, given a preference profile prof : V → LinearOrder C, a real parameter lam : ℝ satisfying (1 : ℝ) / 2 ≤ lam and lam ≤ 1, a candidate finset S : Finset C, a new candidate c_new : C such that c_new ∉ S, and a candidate x : C, if is_weighted_uncovered prof lam S x holds and is_weighted_uncovered prof lam (insert c_new S) x does not hold, then is_weighted_uncovered prof lam (insert c_new S) c_new holds.

Statement

theorem weighted_uncovered_step_invariance {V C : Type*} [Fintype V] [DecidableEq C]
    (prof : V → LinearOrder C) (lam : ℝ) (hlam : 1 / 2 ≤ lam) (hlam1 : lam ≤ 1)
    (S : Finset C) (c_new : C) (hc_new : c_new ∉ S)
    (x : C) (hx : is_weighted_uncovered prof lam S x)
    (h_not : ¬ is_weighted_uncovered prof lam (insert c_new S) x) :
    is_weighted_uncovered prof lam (insert c_new S) c_new
Formalizes
arXiv:2611.30683, Section 4, Theorem 4.3 proof
Verified
29 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 1
  • is_weighted_uncoveredGiven a finite type of voters V, a type of candidates C, a preference profile prof : V → LinearOrder C assigning each voter a linear order…

Read back from the Lean

Let $V$ be a finite type and $C$ be a type with decidable equality. Let $\mathit{prof} : V \to \mathrm{LinearOrder}(C)$ be a profile associating each voter $v \in V$ with a linear order on $C$. Let $\lambda \in \mathbb{R}$ satisfy $1/2 \le \lambda$ and $\lambda \le 1$. Let $S$ be a finite subset of $C$, and let $c_{\mathrm{new}} \in C$ be such that $c_{\mathrm{new}} \notin S$. Let $x \in C$. Suppose that: 1. $x$ is weighted uncovered in $S$ with respect to $\mathit{prof}$ and $\lambda$ (is_weighted_uncovered prof lam S x), and 2. $x$ is not weighted uncovered in $S \cup \{c_{\mathrm{new}}\}$ with respect to $\mathit{prof}$ and $\lambda$ (¬ is_weighted_uncovered prof lam (insert c_new S) x). Then $c_{\mathrm{new}}$ is weighted uncovered in $S \cup \{c_{\mathrm{new}}\}$ with respect to $\mathit{prof}$ and $\lambda$ (is_weighted_uncovered prof lam (insert c_new S) c_new).

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

Lean source view module on GitHub

private lemma weighted_uncovered_step_invariance_lie {C : Type*} (o : LinearOrder C) {a b : C} (h : a ≠ b) :
    o.lt a b ↔ ¬ o.lt b a := by
  constructor
  · intro hab hba
    rw [o.lt_iff_le_not_ge] at hab hba
    exact hab.2 hba.1
  · intro hab
    rw [o.lt_iff_le_not_ge]
    constructor
    · rcases o.le_total a b with hle | hle
      · exact hle
      · exfalso
        exact hab (by rw [o.lt_iff_le_not_ge]; exact ⟨hle, fun hle' => h (o.le_antisymm a b hle' hle)⟩)
    · rintro hle'
      exact hab (by rw [o.lt_iff_le_not_ge]; exact ⟨hle', fun hle'' => h (o.le_antisymm a b hle'' hle')⟩)

private lemma weighted_uncovered_step_invariance_sum {V C : Type*} [Fintype V]
    (prof : V → LinearOrder C) {a b : C} (h : a ≠ b) :
    ((Finset.univ.filter (fun v : V => (prof v).lt a b)).card : ℝ) +
    ((Finset.univ.filter (fun v : V => (prof v).lt b a)).card : ℝ) = (Fintype.card V : ℝ) := by
  have hcongr : (Finset.univ.filter (fun v : V => ¬ (prof v).lt a b)) =
                (Finset.univ.filter (fun v : V => (prof v).lt b a)) := by
    apply Finset.filter_congr
    intro v _
    exact (weighted_uncovered_step_invariance_lie (prof v) h).not.trans not_not
  have hcard := Finset.card_filter_add_card_filter_not (s := (Finset.univ : Finset V))
    (p := fun v : V => (prof v).lt a b)
  rw [hcongr] at hcard
  have hR := congrArg (fun n : ℕ => (n : ℝ)) hcard
  simpa using hR

/-- If an incumbent x was lambda-weighted uncovered in S but is not in S U {c_new}, then the newcomer c_new is lambda-weighted uncovered in S U {c_new}. -/
theorem weighted_uncovered_step_invariance {V C : Type*} [Fintype V] [DecidableEq C]
    (prof : V → LinearOrder C) (lam : ℝ) (hlam : 1 / 2 ≤ lam) (hlam1 : lam ≤ 1)
    (S : Finset C) (c_new : C) (hc_new : c_new ∉ S)
    (x : C) (hx : is_weighted_uncovered prof lam S x)
    (h_not : ¬ is_weighted_uncovered prof lam (insert c_new S) x) :
    is_weighted_uncovered prof lam (insert c_new S) c_new := by
  classical
  rw [is_weighted_uncovered] at hx h_not ⊢
  obtain ⟨hxS, hx_cover⟩ := hx
  have hx_insert : x ∈ insert c_new S := Finset.mem_insert_of_mem hxS
  have h_forall_neg : ¬ (∀ c' ∈ insert c_new S, c' ≠ x →
      (1 - lam) * (Fintype.card V : ℝ) ≤ ((Finset.univ.filter (fun v : V => (prof v).lt c' x)).card : ℝ) ∨
      ∃ c'' ∈ insert c_new S, c'' ≠ x ∧ c'' ≠ c' ∧
        (1 - lam) * (Fintype.card V : ℝ) ≤ ((Finset.univ.filter (fun v : V => (prof v).lt c'' x)).card : ℝ) ∧
        lam * (Fintype.card V : ℝ) ≤ ((Finset.univ.filter (fun v : V => (prof v).lt c' c'')).card : ℝ)) := by
    intro h
    exact h_not ⟨hx_insert, h⟩
  push Not at h_forall_neg
  obtain ⟨b, hb_in, hb_ne_x, hb_lt, hb_block⟩ := h_forall_neg
  have hb_notmem : b ∉ S := by
    intro hbS
    rcases hx_cover b hbS hb_ne_x with hA | hB
    · linarith [hb_lt, hA]
    · obtain ⟨d, hdS, hd_ne_x, hd_ne_b, hd_A, hd_B⟩ := hB
      linarith [hb_block d (Finset.mem_insert_of_mem hdS) hd_ne_x hd_ne_b hd_A, hd_B]
  have hb_eq : b = c_new := by
    rcases Finset.mem_insert.mp hb_in with h | h
    · exact h
    · exact absurd h hb_notmem
  rw [hb_eq] at hb_ne_x hb_lt hb_block
  have hlt_lam : (1 - lam) ≤ lam := by linarith
  have hsum_x : ((Finset.univ.filter (fun v : V => (prof v).lt c_new x)).card : ℝ) +
      ((Finset.univ.filter (fun v : V => (prof v).lt x c_new)).card : ℝ) = (Fintype.card V : ℝ) :=
    weighted_uncovered_step_invariance_sum prof hb_ne_x
  have hx_gt : lam * (Fintype.card V : ℝ) < ((Finset.univ.filter (fun v : V => (prof v).lt x c_new)).card : ℝ) := by
    have h1 : (1 - lam) * (Fintype.card V : ℝ) = (Fintype.card V : ℝ) - lam * (Fintype.card V : ℝ) := by ring
    linarith [hsum_x, hb_lt, h1]
  have hx_ge : (1 - lam) * (Fintype.card V : ℝ) ≤ ((Finset.univ.filter (fun v : V => (prof v).lt x c_new)).card : ℝ) := by
    have hcV : (0:ℝ) ≤ (Fintype.card V : ℝ) := by positivity
    have hle : (1 - lam) * (Fintype.card V : ℝ) ≤ lam * (Fintype.card V : ℝ) := by
      apply mul_le_mul_of_nonneg_right hlt_lam hcV
    linarith [hle, hx_gt]
  refine ⟨Finset.mem_insert_self c_new S, ?_⟩
  intro c' hc'_in hc'_ne_cnew
  have hc'_inS : c' ∈ S := by
    rcases Finset.mem_insert.mp hc'_in with h | h
    · exact absurd h hc'_ne_cnew
    · exact h
  by_cases hc'_eq_x : c' = x
  · subst hc'_eq_x
    left
    exact hx_ge
  · rcases hx_cover c' hc'_inS hc'_eq_x with hA | hB
    · left
      have hltlam : ((Finset.univ.filter (fun v : V => (prof v).lt c_new c')).card : ℝ) < lam * (Fintype.card V : ℝ) :=
        hb_block c' hc'_in hc'_eq_x hc'_ne_cnew hA
      have hsum_c : ((Finset.univ.filter (fun v : V => (prof v).lt c_new c')).card : ℝ) +
          ((Finset.univ.filter (fun v : V => (prof v).lt c' c_new)).card : ℝ) = (Fintype.card V : ℝ) :=
        weighted_uncovered_step_invariance_sum prof hc'_ne_cnew.symm
      have h1 : (1 - lam) * (Fintype.card V : ℝ) = (Fintype.card V : ℝ) - lam * (Fintype.card V : ℝ) := by ring
      linarith [hsum_c, hltlam, h1]
    · obtain ⟨d, hdS, hd_ne_x, hd_ne_c', hd_A, hd_B⟩ := hB
      right
      have hd_ne_cnew : d ≠ c_new := by intro h; exact hc_new (h ▸ hdS)
      refine ⟨d, Finset.mem_insert_of_mem hdS, hd_ne_cnew, hd_ne_c', ?_, hd_B⟩
      have hltlam : ((Finset.univ.filter (fun v : V => (prof v).lt c_new d)).card : ℝ) < lam * (Fintype.card V : ℝ) :=
        hb_block d (Finset.mem_insert_of_mem hdS) hd_ne_x hd_ne_cnew hd_A
      have hsum_d : ((Finset.univ.filter (fun v : V => (prof v).lt c_new d)).card : ℝ) +
          ((Finset.univ.filter (fun v : V => (prof v).lt d c_new)).card : ℝ) = (Fintype.card V : ℝ) :=
        weighted_uncovered_step_invariance_sum prof hd_ne_cnew.symm
      have h1 : (1 - lam) * (Fintype.card V : ℝ) = (Fintype.card V : ℝ) - lam * (Fintype.card V : ℝ) := by ring
      linarith [hsum_d, hltlam, h1]
See it in the graphDiscuss this resultChallenge it