AFTD Auto-Formalizing Theoretical Domains

higher_bruhat_modular_sublevel_packet_consistent

theoremverified

Let n, k, and c be natural numbers such that 2 ≤ k, k + 1 ≤ n, and c < n. Let E be a family of subsets of Fin n such that every element A ∈ E has cardinality k + 1 and satisfies (∑ a ∈ A, a.val) % n = c. Define X to be the family of subsets A of Fin n of cardinality k + 1 such that, with diff = (∑ a ∈ A, (a.val : ℤ)) - (c : ℤ), diff % (n : ℤ) ≠ 0 and the integer quotient diff / (n : ℤ) is odd. Then the union X ∪ E is packet-consistent.

Statement

lemma higher_bruhat_modular_sublevel_packet_consistent
    (n k c : ℕ) (hk : 2 ≤ k) (hn : k + 1 ≤ n) (hc : c < n)
    (E : Finset (Finset (Fin n)))
    (hE : E ⊆ (Finset.univ.filter (fun A : Finset (Fin n) => A.card = k + 1)).filter
      (fun A => (∑ a ∈ A, a.val) % n = c)) :
    let X : Finset (Finset (Fin n)) :=
      (Finset.univ.filter (fun A : Finset (Fin n) => A.card = k + 1)).filter
        (fun A =>
          let diff : ℤ := (∑ a ∈ A, (a.val : ℤ)) - (c : ℤ)
          diff % (n : ℤ) ≠ 0 ∧ Odd (diff / (n : ℤ)))
    higher_bruhat_packet_consistent n k (X ∪ E)
Source
arXiv:2611.17465, Section 2.1, Proof of Proposition 2
Verified
23 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 3
  • higher_bruhat_packet_consistentA family X of subsets of {0, ..., n-1} is packet-consistent if for every subset M ⊆ {0, ..., n-1} of size k+2, the family X satisfies…
  • LinearOrder.toTotalPreorderEvery LinearOrder is a TotalPreorder.
  • TotalPreorderA total preorder: a preorder where ≤ is total (complete). This is weaker than LinearOrder — it does NOT require antisymmetry or…
Used by 1
  • higher_bruhat_inc_poset_dimension_geFor integers k ≥ 2 and n ≥ k+1, the Dushnik–Miller dimension of the inclusion higher Bruhat order B_inc(n, k) satisfies dim B_inc(n, k) ≥…

Read back from the Lean

Given natural numbers $n, k, c$ satisfying $2 \le k$, $k + 1 \le n$, and $c < n$, and a set $E$ of $(k+1)$-element subsets of $\mathrm{Fin}(n)$ whose elements have sum congruent to $c$ modulo $n$: Let $X$ be the set of $(k+1)$-element subsets $A \subseteq \mathrm{Fin}(n)$ such that, for $\mathrm{diff} = (\sum_{a \in A} a) - c \in \mathbb{Z}$, $\mathrm{diff}$ is not divisible by $n$ and the Euclidean integer quotient $\mathrm{diff} / n$ is odd. Then the family of subsets $X \cup E$ is packet consistent for $(n, k)$, meaning that for every $(k+2)$-element subset $M \subseteq \mathrm{Fin}(n)$, either: 1. for all $a, b \in M$ with $a < b$, $M \setminus \{a\} \in X \cup E \implies M \setminus \{b\} \in X \cup E$, or 2. for all $a, b \in M$ with $a < b$, $M \setminus \{b\} \in X \cup E \implies M \setminus \{a\} \in X \cup E$.

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

The proof, explained

A real summary of the proof strategy for testing line ranges. This explains packet consistency by splitting into parity cases.

  1. test claim

    test explanation

    lines 78–164

      intro X M hM
      have hn_pos : 0 < n := by omega
      set T : ℤ := (∑ a ∈ M, (a.val : ℤ)) - (c : ℤ)
      set m : ℤ := T / (n : ℤ)
      have hE_diff (A : Finset (Fin n)) (hA : A ∈ E) :
          ((∑ a ∈ A, (a.val : ℤ)) - (c : ℤ)) % (n : ℤ) = 0 := by
        have hA' := hE hA
        simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hA'
        have hcast : (∑ a ∈ A, (a.val : ℤ)) = ((∑ a ∈ A, a.val : ℕ) : ℤ) := by
          push_cast; rfl
        rw [hcast]
        exact higher_bruhat_modular_sublevel_packet_consistent_sub_mod_eq_zero n c (∑ a ∈ A, a.val) hA'.2
      have h_card (x : Fin n) (hx : x ∈ M) : (M.erase x).card = k + 1 := by
        rw [Finset.card_erase_of_mem hx, hM]
        rfl
      have h_diff_eq (x : Fin n) (hx : x ∈ M) :
          (∑ a ∈ M.erase x, (a.val : ℤ)) - (c : ℤ) = T - (x.val : ℤ) := by
        dsimp [T]
        have h := Finset.sum_erase_add M (fun a : Fin n => (a.val : ℤ)) hx
        linarith
      have h_mem_X (x : Fin n) (hx : x ∈ M) :
          M.erase x ∈ X ↔
            (T - (x.val : ℤ)) % (n : ℤ) ≠ 0 ∧ Odd ((T - (x.val : ℤ)) / (n : ℤ)) := by
        dsimp [X]
        rw [Finset.mem_filter, Finset.mem_filter]
        simp only [Finset.mem_univ, true_and, h_card x hx]
        rw [h_diff_eq x hx]
      by_cases hm : Odd m
      · right
        intro a ha b hb hab hb_union
        rw [Finset.mem_union] at hb_union
        have hb_not_lt : ¬ (T - (b.val : ℤ) < m * (n : ℤ)) := by
          intro h_lt
          have h_div_mod := higher_bruhat_modular_sublevel_packet_consistent_div_mod_lt
            n hn_pos T (b.val : ℤ) (by positivity) (by omega) h_lt
          have h_not_odd : ¬ Odd ((T - (b.val : ℤ)) / (n : ℤ)) := by
            rw [h_div_mod.1, odd_sub_one]
            intro he
            exact (Int.not_even_iff_odd.mpr hm) he
          cases hb_union with
          | inl hX =>
            have := (h_mem_X b hb).mp hX
            exact h_not_odd this.2
          | inr hE_mem =>
            have h_zero := hE_diff (M.erase b) hE_mem
            rw [h_diff_eq b hb] at h_zero
            exact h_div_mod.2 h_zero
        have hb_ge : m * (n : ℤ) ≤ T - (b.val : ℤ) := by omega
        have hab_val : (a.val : ℤ) < (b.val : ℤ) := by omega
        have ha_gt : T - (a.val : ℤ) > m * (n : ℤ) := by omega
        have h_div_mod_a := higher_bruhat_modular_sublevel_packet_consistent_div_mod_gt
          n hn_pos T (a.val : ℤ) (by positivity) (by omega) ha_gt
        have ha_X : M.erase a ∈ X := by
          rw [h_mem_X a ha]
          refine ⟨h_div_mod_a.2, ?_⟩
          rw [h_div_mod_a.1]
          exact hm
        exact Finset.mem_union_left E ha_X
      · left
        intro a ha b hb hab ha_union
        rw [Finset.mem_union] at ha_union
        have ha_not_gt : ¬ (T - (a.val : ℤ) > m * (n : ℤ)) := by
          intro h_gt
          have h_div_mod := higher_bruhat_modular_sublevel_packet_consistent_div_mod_gt
            n hn_pos T (a.val : ℤ) (by positivity) (by omega) h_gt
          have h_not_odd : ¬ Odd ((T - (a.val : ℤ)) / (n : ℤ)) := by
            rw [h_div_mod.1]
            exact hm
          cases ha_union with
          | inl hX =>
            have := (h_mem_X a ha).mp hX
            exact h_not_odd this.2
          | inr hE_mem =>
            have h_zero := hE_diff (M.erase a) hE_mem
            rw [h_diff_eq a ha] at h_zero
            exact h_div_mod.2 h_zero
        have ha_le : T - (a.val : ℤ) ≤ m * (n : ℤ) := by omega
        have hab_val : (a.val : ℤ) < (b.val : ℤ) := by omega
        have hb_lt : T - (b.val : ℤ) < m * (n : ℤ) := by omega
        have h_div_mod_b := higher_bruhat_modular_sublevel_packet_consistent_div_mod_lt
          n hn_pos T (b.val : ℤ) (by positivity) (by omega) hb_lt
        have hb_X : M.erase b ∈ X := by
          rw [h_mem_X b hb]
          refine ⟨h_div_mod_b.2, ?_⟩
          rw [h_div_mod_b.1, odd_sub_one]
          exact Int.not_odd_iff_even.mp hm
        exact Finset.mem_union_left E hb_X

Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.

Lean source view module on GitHub

lemma higher_bruhat_modular_sublevel_packet_consistent_sub_mod_eq_zero (n c s : ℕ) (hs : s % n = c) :    ((s : ℤ) - (c : ℤ)) % (n : ℤ) = 0 := by  have h_mod : (s : ℤ) % (n : ℤ) = (c : ℤ) := by    rw [← hs]    exact Int.ofNat_mod_ofNat s n  have h_div : (s : ℤ) = (n : ℤ) * ((s : ℤ) / (n : ℤ)) + (s : ℤ) % (n : ℤ) :=    (Int.mul_ediv_add_emod (s : ℤ) (n : ℤ)).symm  rw [h_mod] at h_div  have h_sub : (s : ℤ) - (c : ℤ) = (n : ℤ) * ((s : ℤ) / (n : ℤ)) := by    omega  rw [h_sub]  exact Int.mul_emod_right (n : ℤ) ((s : ℤ) / (n : ℤ))lemma higher_bruhat_modular_sublevel_packet_consistent_div_mod_gt (n : ℕ) (hn : 0 < n) (T x_val : ℤ) (hx : 0 ≤ x_val) (_hxn : x_val < (n : ℤ)) :    let d := T - x_val    let m := T / (n : ℤ)    d > m * (n : ℤ) → d / (n : ℤ) = m ∧ d % (n : ℤ) ≠ 0 := by  intro d m hd  have hn_pos : 0 < (n : ℤ) := by omega  have h_div : T = (n : ℤ) * m + T % (n : ℤ) := by    dsimp [m]    exact (Int.mul_ediv_add_emod T (n : ℤ)).symm  have hd' : m * (n : ℤ) < d := hd  rw [mul_comm] at hd'  have h_rem1 : 0 ≤ T % (n : ℤ) - x_val := by    dsimp [d] at hd'    omega  have h_rem2 : T % (n : ℤ) - x_val < (n : ℤ) := by    have := Int.emod_lt_of_pos T hn_pos    omega  have h_eq : (T % (n : ℤ) - x_val) + (n : ℤ) * m = d := by    dsimp [d]    linarith  have h_uniq := (Int.ediv_emod_unique hn_pos).mpr ⟨h_eq, h_rem1, h_rem2⟩  refine ⟨h_uniq.1, ?_⟩  rw [h_uniq.2]  dsimp [d] at hd'  omegalemma higher_bruhat_modular_sublevel_packet_consistent_div_mod_lt (n : ℕ) (hn : 0 < n) (T x_val : ℤ) (_hx : 0 ≤ x_val) (hxn : x_val < (n : ℤ)) :    let d := T - x_val    let m := T / (n : ℤ)    d < m * (n : ℤ) → d / (n : ℤ) = m - 1 ∧ d % (n : ℤ) ≠ 0 := by  intro d m hd  have hn_pos : 0 < (n : ℤ) := by omega  have h_div : T = (n : ℤ) * m + T % (n : ℤ) := by    dsimp [m]    exact (Int.mul_ediv_add_emod T (n : ℤ)).symm  have hd' : d < m * (n : ℤ) := hd  rw [mul_comm] at hd'  have h_rem1 : 0 ≤ T % (n : ℤ) - x_val + (n : ℤ) := by    have := Int.emod_nonneg T (by omega : (n : ℤ) ≠ 0)    omega  have h_rem2 : T % (n : ℤ) - x_val + (n : ℤ) < (n : ℤ) := by    dsimp [d] at hd'    omega  have h_eq : (T % (n : ℤ) - x_val + (n : ℤ)) + (n : ℤ) * (m - 1) = d := by    dsimp [d]    linarith  have h_uniq := (Int.ediv_emod_unique hn_pos).mpr ⟨h_eq, h_rem1, h_rem2⟩  refine ⟨h_uniq.1, ?_⟩  rw [h_uniq.2]  have := Int.emod_nonneg T (by omega : (n : ℤ) ≠ 0)  omega/-- Consistency of the union of the alternating sublevel family with any subcollection of the modular level set. -/lemma higher_bruhat_modular_sublevel_packet_consistent    (n k c : ℕ) (hk : 2 ≤ k) (hn : k + 1 ≤ n) (hc : c < n)    (E : Finset (Finset (Fin n)))    (hE : E ⊆ (Finset.univ.filter (fun A : Finset (Fin n) => A.card = k + 1)).filter      (fun A => (∑ a ∈ A, a.val) % n = c)) :    let X : Finset (Finset (Fin n)) :=      (Finset.univ.filter (fun A : Finset (Fin n) => A.card = k + 1)).filter        (fun A =>          let diff : ℤ := (∑ a ∈ A, (a.val : ℤ)) - (c : ℤ)          diff % (n : ℤ) ≠ 0 ∧ Odd (diff / (n : ℤ)))    higher_bruhat_packet_consistent n k (X ∪ E) := by  intro X M hM  have hn_pos : 0 < n := by omega  set T : ℤ := (∑ a ∈ M, (a.val : ℤ)) - (c : ℤ)  set m : ℤ := T / (n : ℤ)  have hE_diff (A : Finset (Fin n)) (hA : A ∈ E) :      ((∑ a ∈ A, (a.val : ℤ)) - (c : ℤ)) % (n : ℤ) = 0 := by    have hA' := hE hA    simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hA'    have hcast : (∑ a ∈ A, (a.val : ℤ)) = ((∑ a ∈ A, a.val : ℕ) : ℤ) := by      push_cast; rfl    rw [hcast]    exact higher_bruhat_modular_sublevel_packet_consistent_sub_mod_eq_zero n c (∑ a ∈ A, a.val) hA'.2  have h_card (x : Fin n) (hx : x ∈ M) : (M.erase x).card = k + 1 := by    rw [Finset.card_erase_of_mem hx, hM]    rfl  have h_diff_eq (x : Fin n) (hx : x ∈ M) :      (∑ a ∈ M.erase x, (a.val : ℤ)) - (c : ℤ) = T - (x.val : ℤ) := by    dsimp [T]    have h := Finset.sum_erase_add M (fun a : Fin n => (a.val : ℤ)) hx    linarith  have h_mem_X (x : Fin n) (hx : x ∈ M) :      M.erase x ∈ X ↔        (T - (x.val : ℤ)) % (n : ℤ) ≠ 0 ∧ Odd ((T - (x.val : ℤ)) / (n : ℤ)) := by    dsimp [X]    rw [Finset.mem_filter, Finset.mem_filter]    simp only [Finset.mem_univ, true_and, h_card x hx]    rw [h_diff_eq x hx]  by_cases hm : Odd m  · right    intro a ha b hb hab hb_union    rw [Finset.mem_union] at hb_union    have hb_not_lt : ¬ (T - (b.val : ℤ) < m * (n : ℤ)) := by      intro h_lt      have h_div_mod := higher_bruhat_modular_sublevel_packet_consistent_div_mod_lt        n hn_pos T (b.val : ℤ) (by positivity) (by omega) h_lt      have h_not_odd : ¬ Odd ((T - (b.val : ℤ)) / (n : ℤ)) := by        rw [h_div_mod.1, odd_sub_one]        intro he        exact (Int.not_even_iff_odd.mpr hm) he      cases hb_union with      | inl hX =>        have := (h_mem_X b hb).mp hX        exact h_not_odd this.2      | inr hE_mem =>        have h_zero := hE_diff (M.erase b) hE_mem        rw [h_diff_eq b hb] at h_zero        exact h_div_mod.2 h_zero    have hb_ge : m * (n : ℤ) ≤ T - (b.val : ℤ) := by omega    have hab_val : (a.val : ℤ) < (b.val : ℤ) := by omega    have ha_gt : T - (a.val : ℤ) > m * (n : ℤ) := by omega    have h_div_mod_a := higher_bruhat_modular_sublevel_packet_consistent_div_mod_gt      n hn_pos T (a.val : ℤ) (by positivity) (by omega) ha_gt    have ha_X : M.erase a ∈ X := by      rw [h_mem_X a ha]      refine ⟨h_div_mod_a.2, ?_⟩      rw [h_div_mod_a.1]      exact hm    exact Finset.mem_union_left E ha_X  · left    intro a ha b hb hab ha_union    rw [Finset.mem_union] at ha_union    have ha_not_gt : ¬ (T - (a.val : ℤ) > m * (n : ℤ)) := by      intro h_gt      have h_div_mod := higher_bruhat_modular_sublevel_packet_consistent_div_mod_gt        n hn_pos T (a.val : ℤ) (by positivity) (by omega) h_gt      have h_not_odd : ¬ Odd ((T - (a.val : ℤ)) / (n : ℤ)) := by        rw [h_div_mod.1]        exact hm      cases ha_union with      | inl hX =>        have := (h_mem_X a ha).mp hX        exact h_not_odd this.2      | inr hE_mem =>        have h_zero := hE_diff (M.erase a) hE_mem        rw [h_diff_eq a ha] at h_zero        exact h_div_mod.2 h_zero    have ha_le : T - (a.val : ℤ) ≤ m * (n : ℤ) := by omega    have hab_val : (a.val : ℤ) < (b.val : ℤ) := by omega    have hb_lt : T - (b.val : ℤ) < m * (n : ℤ) := by omega    have h_div_mod_b := higher_bruhat_modular_sublevel_packet_consistent_div_mod_lt      n hn_pos T (b.val : ℤ) (by positivity) (by omega) hb_lt    have hb_X : M.erase b ∈ X := by      rw [h_mem_X b hb]      refine ⟨h_div_mod_b.2, ?_⟩      rw [h_div_mod_b.1, odd_sub_one]      exact Int.not_odd_iff_even.mp hm    exact Finset.mem_union_left E hb_X
See it in the graphDiscuss this resultChallenge it