AFTD Auto-Formalizing Theoretical Domains

five_odd_saturated_small_shore_aggregate_patterns

theoremverified

The displayed nonnegative aggregate component counts, endpoint budgets, representative degree bounds, separator inequalities, and B-block odd-group inequalities imply one of the two displayed grouped small-shore patterns. The parameter m permits arbitrarily many additional odd B-only components.

Statement

theorem five_odd_saturated_small_shore_aggregate_patterns
    (k c m eb : ℕ) (g : Fin 4 → Fin 4 → ℕ)
    (hc : 7 ≤ c) (hkc : c ≤ k)
    (hEB : m ≤ eb)
    (hzero : ∀ j : Fin 4, j ≠ 0 → g j 0 = 0 ∧ g j 3 = 0)
    (hgroup0 : Odd (∑ b : Fin 4, g 0 b))
    (hgroup1 : Odd (∑ b : Fin 4, g 1 b))
    (hgroupE : ∀ j : Fin 4, j = 2 ∨ j = 3 →
      (g j 2 = 0 ∧ g j 1 = 0) ∨ 1 ≤ g j 2)
    (hroot : 1 ≤ g 0 0 ∧ g 0 0 ≤ 2 ∧ 1 ≤ g 1 2)
    (hcounts : let s := m + (if 1 ≤ g 2 2 then 1 else 0) + (if 1 ≤ g 3 2 then 1 else 0);
      let sz : Fin 4 → ℕ := ![5, 2*k-5, c, 2*k-c];
      let tot : Fin 4 → ℕ := fun b => (∑ j : Fin 4, g j b) + (if b = 1 then eb else 0);
      s+1 ≤ c ∧ s+1 ≤ k ∧ (∀ b, tot b ≤ sz b) ∧
      (∑ b : Fin 4, tot b) + s = 2*k ∧ g 1 2 + g 2 2 + g 3 2 ≤ 3 ∧
      (∑ j ∈ (Finset.univ : Finset (Fin 4)).erase 0, (g j 0 + g j 2 + g j 3)) ≤ 3 ∧
      (∑ j ∈ (Finset.univ : Finset (Fin 4)).erase 1, (g j 0 + g j 1 + g j 2)) + eb + 2 ≤ c)
    (hrep : let sz : Fin 4 → ℕ := ![5, 2*k-5, c, 2*k-c];
      let forbid : Fin 4 → Fin 4 := ![1,0,3,2];
      let tot : Fin 4 → ℕ := fun b => (∑ j : Fin 4, g j b) + (if b = 1 then eb else 0);
      ∀ j b : Fin 4,
        (if (j = 0 ∧ b = 0) ∨ (j = 1 ∧ b = 2) then 2 else 1) ≤ g j b →
        (∑ t ∈ (Finset.univ : Finset (Fin 4)).erase (forbid b), (tot t - g j t)) + 3 ≤ sz b)
    (hcuts : let sz : Fin 4 → ℕ := ![5, 2*k-5, c, 2*k-c];
      let tot : Fin 4 → ℕ := fun b => (∑ j : Fin 4, g j b) + (if b = 1 then eb else 0);
      (∀ j b : Fin 4, (b = 1 ∨ b = 3) → 1 ≤ g j b →
        g j b + (tot 1 - g j 1) + (tot 3 - g j 3) ≤ sz b) ∧
      (m > 0 → tot 1 + tot 3 ≤ sz 1) ∧
      (∀ j : Fin 4,
        (1 ≤ g j 0 - (if j = 0 then 1 else 0) →
          g j 0 - (if j = 0 then 1 else 0) + (tot 3 - g j 3) ≤ 5) ∧
        (1 ≤ g j 2 - (if j = 1 then 1 else 0) →
          g j 2 - (if j = 1 then 1 else 0) + (tot 1 - g j 1) ≤ c) ∧
        (1 ≤ tot 0 - g j 0 - (if j = 1 then 1 else 0) →
          g j 0 + g j 2 + g j 3 + (tot 0 - g j 0 - (if j = 1 then 1 else 0)) ≤ 5 + (tot 1 - g j 1)) ∧
        (1 ≤ tot 2 - g j 2 - (if j = 0 then 1 else 0) →
          g j 0 + g j 1 + g j 2 + (tot 2 - g j 2 - (if j = 0 then 1 else 0)) ≤ c + (tot 3 - g j 3))))
    (hcrit : let sz : Fin 4 → ℕ := ![5, 2*k-5, c, 2*k-c];
      let tot : Fin 4 → ℕ := fun b => (∑ j : Fin 4, g j b) + (if b = 1 then eb else 0);
      let groups : Fin 4 → ℕ := fun b => (∑ j : Fin 4, if 1 ≤ g j b then 1 else 0) + (if b = 1 then m else 0);
      (tot 1 < sz 1 → m + tot 1 + 1 ≤ sz 1) ∧
        (tot 1 = sz 1 → m ≤ 1 ∧ groups 1 ≤ 1))
    (hconnected : (g 0 0 = 1 → g 0 2 + g 0 3 = 0 → g 0 1 = 0) ∧
      (g 1 2 = 1 → g 1 0 + g 1 1 = 0 → g 1 3 = 0)) :
    g 0 0 = 1 ∧
      ((g 1 2 = 3 ∧ g 2 2 + g 3 2 = 0 ∧
        (g 0 1 + g 0 2 + g 2 1 + g 2 2 + g 3 1 + g 3 2 + eb) + 4 = c) ∨
       (g 1 2 = 1 ∧ g 2 2 + g 3 2 = 2 ∧
        (∀ j : Fin 4, j = 2 ∨ j = 3 → 1 ≤ g j 2 → g j 2 = 1 ∧ (∑ b : Fin 4, g j b) = 1)))
Source
OP-1957: unbounded aggregate integer reduction for the saturated five-by-odd small-shore branch.
Verified
24 Nov 2026
Axioms
Classical.choiceQuot.soundpropext

The proof, explained

The theorem classifies the aggregate component counts of a saturated graph into two small-shore patterns. First, non-root component vanishings on external blocks are used to simplify group sizes, total sums, and separator and representative bounds. These specialize to the hypotheses of an auxiliary integer linear arithmetic lemma, which establishes by exhaustive case analysis and Presburger arithmetic that the root count must be 1 and the small-shore components either concentrate with weight 3 on the primary odd group or split with weight 1 on the primary group and weight 1 on each of two secondary groups. Finally, the secondary groups in the second pattern are shown to have total size 1 using the vanishing of their remaining coordinates.

  1. Either the B-block aggregate plus m + 6 is at most 2k, or the B-block aggregate plus 5 equals 2k with m ≤ 1 and at most one positive group indicator.

    We perform a case split on whether b0 + b1 + b2 + b3 + eb + 5 < 2*k. In the strict inequality case, the first clause of hcrit directly yields m + b0 + b1 + b2 + b3 + eb + 6 ≤ 2*k. In the negation case, linear integer arithmetic forces equality to 2*k, and the second clause of hcrit supplies the bounds m ≤ 1 and the indicator sum condition.

    lines 30–38

    uses Or.inl, Or.inr

      have hcritical : (m+b0+b1+b2+b3+eb+6 ≤ 2*k) ∨
          (b0+b1+b2+b3+eb+5 = 2*k ∧ m ≤ 1 ∧
            (if 1 ≤ b0 then 1 else 0) + (if 1 ≤ b1 then 1 else 0) +
            (if 1 ≤ b2 then 1 else 0) + (if 1 ≤ b3 then 1 else 0) + m ≤ 1) := by
        by_cases h : b0+b1+b2+b3+eb+5 < 2*k
        · exact Or.inl (hcrit.1 h)
        · have heq : b0+b1+b2+b3+eb+5 = 2*k := by omega
          exact Or.inr ⟨heq, hcrit.2 heq⟩
      clear hcrit
  2. Under the arithmetic hypotheses, a = 1 and the small-shore counts (c1, c2, c3) satisfy either c1 = 3 and c2 + c3 = 0, or c1 = 1 and c2 + c3 = 2 with cj = 1 and bj + cj = 1 whenever 1 ≤ cj for j ∈ {2, 3}. automation

    We destruct the criticality dichotomy hcritical and case split on whether c2 = b2 = 0 or 1 ≤ c2, and whether c3 = b3 = 0 or 1 ≤ c3. Unpacking the parity hypotheses hodd0 and hodd1 into explicit quotients (2*t0 + 1 and 2*t1 + 1), simp_all simplifies the goal states, and every branch is resolved by Presburger linear arithmetic (omega) combined with if-then-else case splitting (split_ifs).

    lines 39–44

      rcases hcritical with hpos | hfull
      all_goals rcases he2 with h2 | h2 <;> rcases he3 with h3 | h3
      all_goals obtain ⟨t0, ht0⟩ := hodd0
      all_goals obtain ⟨t1, ht1⟩ := hodd1
      all_goals simp_all
      all_goals first | omega | (split_ifs at * <;> omega)
  3. Non-root odd groups j ∈ {1, 2, 3} vanish on blocks 0 and 3, and the erased index sets of Fin 4 are explicitly computed.

    Hypothesis hzero asserts that for any non-root index j ≠ 0, g j 0 = 0 and g j 3 = 0. We specialize this at j = 1, 2, 3 by computation. We also evaluate the erased universal index sets Fin 4 \ {0}, Fin 4 \ {1}, and Fin 4 \ {3} by decidability.

    lines 95–104

      classical
      have hz10 := (hzero 1 (by decide)).1
      have hz20 := (hzero 2 (by decide)).1
      have hz30 := (hzero 3 (by decide)).1
      have hz13 := (hzero 1 (by decide)).2
      have hz23 := (hzero 2 (by decide)).2
      have hz33 := (hzero 3 (by decide)).2
      have e0 : (Finset.univ : Finset (Fin 4)).erase 0 = {1,2,3} := by decide
      have e1 : (Finset.univ : Finset (Fin 4)).erase 1 = {0,2,3} := by decide
      have e3 : (Finset.univ : Finset (Fin 4)).erase 3 = {0,1,2} := by decide
  4. The parity sums on groups 0 and 1 reduce to sums over non-vanishing blocks, and groups 2 and 3 each either vanish on blocks 1 and 2 or have weight at least 1 on block 2.

    We expand the universal sum over Fin 4 with Fin.sum_univ_four. For group 0, the sum g 0 0 + g 0 1 + g 0 2 + g 0 3 is odd by hgroup0. For group 1, since g 1 0 = 0 and g 1 3 = 0, the sum simplifies to g 1 1 + g 1 2, which is odd by hgroup1. We also specialize hgroupE to j = 2 and j = 3 using Or.inl and Or.inr.

    lines 105–108

    uses Fin.sum_univ_four, Or.inl, Or.inr

      have ho0 : Odd (g 0 0 + g 0 1 + g 0 2 + g 0 3) := by simpa [Fin.sum_univ_four] using hgroup0
      have ho1 : Odd (g 1 1 + g 1 2) := by simpa [Fin.sum_univ_four,hz10,hz13] using hgroup1
      have he2 : (g 2 2=0 ∧ g 2 1=0) ∨ 1 ≤ g 2 2 := hgroupE 2 (Or.inl rfl)
      have he3 : (g 3 2=0 ∧ g 3 1=0) ∨ 1 ≤ g 3 2 := hgroupE 3 (Or.inr rfl)
  5. The aggregate counts satisfy the separator bound, the block-1 capacity bound, the total sum identity equal to 2k, the small-shore bound g 1 2 + g 2 2 + g 3 2 ≤ 3, and the root separator inequality.

    From hcounts, we extract the separator inequality s + 1 ≤ c. Specializing the block capacity tot 1 ≤ sz 1 = 2*k - 5 and expanding the sum gives the block-1 capacity bound. Expanding the total partition sum ∑ tot b + s = 2*k using Fin.sum_univ_four and substituting the vanishing coordinates yields the exact sum 2*k. We also extract g 1 2 + g 2 2 + g 3 2 ≤ 3 and expand the root separator inequality.

    lines 109–123

    uses Fin.sum_univ_four

      have hs : m + (if 1 ≤ g 2 2 then 1 else 0) + (if 1 ≤ g 3 2 then 1 else 0) + 1 ≤ c := hcounts.1
      have hb : g 0 1+g 1 1+g 2 1+g 3 1+eb+5 ≤ 2*k := by
        have hh := hcounts.2.2.1 (1 : Fin 4)
        simp [Fin.sum_univ_four] at hh
        omega
      have ht : g 0 0+g 0 1+g 1 1+g 2 1+g 3 1+eb+g 0 2+g 1 2+g 2 2+g 3 2+g 0 3+m+
          (if 1 ≤ g 2 2 then 1 else 0)+(if 1 ≤ g 3 2 then 1 else 0)=2*k := by
        have hh := hcounts.2.2.2.1
        simp [Fin.sum_univ_four,hz10,hz20,hz30,hz13,hz23,hz33] at hh
        omega
      have hsmall : g 1 2+g 2 2+g 3 2≤3 := hcounts.2.2.2.2.1
      have hry : g 0 0+g 0 1+g 0 2+g 2 1+g 2 2+g 3 1+g 3 2+eb+2≤c := by
        have hh := hcounts.2.2.2.2.2.2
        simp [e1,Fin.sum_univ_four,hz10,hz20,hz30,hz13,hz23,hz33] at hh
        omega
  6. Representative degree bounds and separator cut inequalities specialize to bounds on individual components when representatives are present.

    We specialize the representative degree hypothesis hrep at (j, b) ∈ {(0,0), (0,2), (1,2), (2,2), (3,2)} and the separator cut hypothesis hcuts at (0,3). In each case, expanding sums with Fin.sum_univ_four and substituting the erased index sets and vanishing components yields the inequalities needed for the arithmetic lemma: if g 0 0 ≥ 2, the other block-2 components sum to at most 2; if g 0 2, g 1 2, g 2 2, or g 3 2 is positive (or at least 2 for g 1 2), the respective representative sum is bounded by c; and if g 0 3 ≥ 1, the cut inequality bounds the sum by 2*k.

    lines 124–159

    uses Fin.sum_univ_four, Or.inr

      have hrA : 2≤g 0 0 → g 1 2+g 2 2+g 3 2≤2 := by
        intro h
        have hh := hrep 0 0 (by simpa using h)
        dsimp at hh
        simp [e0,e1,e3,Fin.sum_univ_four,hz10,hz20,hz30,hz13,hz23,hz33] at hh
        omega
      have hr0 : 1≤g 0 2 → g 1 1+g 2 1+g 3 1+eb+g 1 2+g 2 2+g 3 2+3≤c := by
        intro h
        have hh := hrep 0 2 (by simpa using h)
        dsimp at hh
        simp [e0,e1,e3,Fin.sum_univ_four,hz10,hz20,hz30,hz13,hz23,hz33] at hh
        omega
      have hcd : 1≤g 0 3 → g 0 3+g 1 1+g 2 1+g 3 1+eb+c≤2*k := by
        intro h
        have hh := hcuts.1 0 3 (Or.inr rfl) h
        dsimp at hh
        simp [e0,e1,e3,Fin.sum_univ_four,hz10,hz20,hz30,hz13,hz23,hz33] at hh
        omega
      have hr1 : 2≤g 1 2 → g 0 0+g 0 1+g 2 1+g 3 1+eb+g 0 2+g 2 2+g 3 2+3≤c := by
        intro h
        have hh := hrep 1 2 (by simpa using h)
        dsimp at hh
        simp [e0,e1,e3,Fin.sum_univ_four,hz10,hz20,hz30,hz13,hz23,hz33] at hh
        omega
      have hr2 : 1≤g 2 2 → g 0 0+g 0 1+g 1 1+g 3 1+eb+g 0 2+g 1 2+g 3 2+3≤c := by
        intro h
        have hh := hrep 2 2 (by simpa using h)
        dsimp at hh
        simp [e0,e1,e3,Fin.sum_univ_four,hz10,hz20,hz30,hz13,hz23,hz33] at hh
        omega
      have hr3 : 1≤g 3 2 → g 0 0+g 0 1+g 1 1+g 2 1+eb+g 0 2+g 1 2+g 2 2+3≤c := by
        intro h
        have hh := hrep 3 2 (by simpa using h)
        dsimp at hh
        simp [e0,e1,e3,Fin.sum_univ_four,hz10,hz20,hz30,hz13,hz23,hz33] at hh
        omega
  7. The criticality condition hcrit specializes to block 1 as required by the arithmetic lemma.

    From hcrit, specializing to block 1 with capacity sz 1 = 2*k - 5: if the block-1 sum is strictly less than 2*k - 5, adding m + 1 is at most 2*k - 5 (so adding m + 6 is at most 2*k); if it equals 2*k - 5, then m ≤ 1 and the sum of indicator variables for non-zero groups in block 1 plus m is at most 1.

    lines 160–175

    uses Fin.sum_univ_four

      have hcrit' : (g 0 1+g 1 1+g 2 1+g 3 1+eb+5<2*k →
          m+g 0 1+g 1 1+g 2 1+g 3 1+eb+6≤2*k) ∧
        (g 0 1+g 1 1+g 2 1+g 3 1+eb+5=2*k → m≤1 ∧
          (if 1≤g 0 1 then 1 else 0)+(if 1≤g 1 1 then 1 else 0)+
          (if 1≤g 2 1 then 1 else 0)+(if 1≤g 3 1 then 1 else 0)+m≤1) := by
        constructor
        · intro h
          have hh := hcrit.1
          simp [Fin.sum_univ_four] at hh
          have hh' := hh (by omega)
          omega
        · intro h
          have hh := hcrit.2
          dsimp at hh
          simp only [Fin.sum_univ_four] at hh
          exact hh (by omega)
  8. The root count satisfies g 0 0 = 1, and the block-2 small-shore counts satisfy either g 1 2 = 3 with g 2 2 + g 3 2 = 0, or g 1 2 = 1 with g 2 2 + g 3 2 = 2.

    We apply the arithmetic lemma in1158_small_odd_endpoint_arithmetic with a = g 0 0, b_j = g j 1, c_j = g j 2, and d = g 0 3, supplying all the derived component bounds, odd parities, capacities, and separator inequalities.

    lines 176–178

    uses in1158_small_odd_endpoint_arithmetic

      have hr := in1158_small_odd_endpoint_arithmetic k c m eb (g 0 0) (g 0 1) (g 1 1) (g 2 1) (g 3 1)
        (g 0 2) (g 1 2) (g 2 2) (g 3 2) (g 0 3) hc hkc hEB ⟨hroot.1,hroot.2.1⟩
        hroot.2.2 he2 he3 ho0 ho1 hs hb ht hsmall hry hrA hr0 hcd hr1 hr2 hr3 hcrit' hconnected.1
  9. The aggregate counts satisfy one of the two grouped small-shore patterns, with secondary groups in the second pattern having total size 1.

    In the first case where g 1 2 = 3 and g 2 2 + g 3 2 = 0, the arithmetic lemma directly matches the first pattern via Or.inl. In the second case where g 1 2 = 1 and g 2 2 + g 3 2 = 2, for each j ∈ {2, 3} with g j 2 ≥ 1, the lemma gives g j 2 = 1 and g j 1 + g j 2 = 1. Since g j 0 = 0 and g j 3 = 0, expanding ∑ b, g j b with Fin.sum_univ_four shows that the total group size is 0 + 0 + 1 + 0 = 1, completing the second pattern via Or.inr.

    lines 179–189

    uses Fin.sum_univ_four, Or.inl, Or.inr

      rcases hr with ⟨ha, hcase | hcase⟩
      · exact ⟨ha,Or.inl hcase⟩
      · refine ⟨ha, Or.inr ⟨hcase.1,hcase.2.1,?_⟩⟩
        intro j hj hjpos
        rcases hj with rfl | rfl
        · have hh := hcase.2.2.1 hjpos
          simp [Fin.sum_univ_four,hz20,hz23]
          omega
        · have hh := hcase.2.2.2 hjpos
          simp [Fin.sum_univ_four,hz30,hz33]
          omega
Or.inl
From a proof of P, infer the disjunction P ∨ Q.
Or.inr
From a proof of Q, infer the disjunction P ∨ Q.
Fin.sum_univ_four
The sum of a function f over Fin 4 equals f 0 + f 1 + f 2 + f 3.
in1158_small_odd_endpoint_arithmetic
Under the component budgets, capacity constraints, parity conditions, separator inequalities, and representative bounds, the root component count is 1 and the small-shore block-2 counts satisfy either (c1 = 3, c2 + c3 = 0) or (c1 = 1, c2 + c3 = 2) with specific component equations.

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

set_option maxHeartbeats 2000000private theorem in1158_small_odd_endpoint_arithmetic    (k c m eb a b0 b1 b2 b3 c0 c1 c2 c3 d : ℕ)    (hc : 7 ≤ c) (hkc : c ≤ k) (heb : m ≤ eb)    (ha : 1 ≤ a ∧ a ≤ 2) (hc1 : 1 ≤ c1)    (he2 : (c2 = 0 ∧ b2 = 0) ∨ 1 ≤ c2)    (he3 : (c3 = 0 ∧ b3 = 0) ∨ 1 ≤ c3)    (hodd0 : Odd (a+b0+c0+d)) (hodd1 : Odd (b1+c1))    (hs : m + (if 1 ≤ c2 then 1 else 0) + (if 1 ≤ c3 then 1 else 0) + 1 ≤ c)    (hb : b0+b1+b2+b3+eb+5 ≤ 2*k)    (htotal : a+b0+b1+b2+b3+eb+c0+c1+c2+c3+d+m+      (if 1 ≤ c2 then 1 else 0) + (if 1 ≤ c3 then 1 else 0) = 2*k)    (hsmall : c1+c2+c3 ≤ 3)    (hrooty : a+b0+c0+b2+c2+b3+c3+eb+2 ≤ c)    (hrepA : 2 ≤ a → c1+c2+c3 ≤ 2)    (hrep0C : 1 ≤ c0 → b1+b2+b3+eb+c1+c2+c3+3 ≤ c)    (hcutD : 1 ≤ d → d+b1+b2+b3+eb+c ≤ 2*k)    (hrep1C : 2 ≤ c1 → a+b0+b2+b3+eb+c0+c2+c3+3 ≤ c)    (hrep2C : 1 ≤ c2 → a+b0+b1+b3+eb+c0+c1+c3+3 ≤ c)    (hrep3C : 1 ≤ c3 → a+b0+b1+b2+eb+c0+c1+c2+3 ≤ c)    (hcrit : (b0+b1+b2+b3+eb+5 < 2*k →        m+b0+b1+b2+b3+eb+6 ≤ 2*k) ∧      (b0+b1+b2+b3+eb+5 = 2*k → m ≤ 1 ∧        (if 1 ≤ b0 then 1 else 0) + (if 1 ≤ b1 then 1 else 0) +        (if 1 ≤ b2 then 1 else 0) + (if 1 ≤ b3 then 1 else 0) + m ≤ 1))    (hxconn : a=1 → c0+d=0 → b0=0) :    a=1 ∧ ((c1=3 ∧ c2+c3=0 ∧ b0+c0+b2+c2+b3+c3+eb+4=c) ∨      (c1=1 ∧ c2+c3=2 ∧ (1 ≤ c2 → c2=1 ∧ b2+c2=1) ∧        (1 ≤ c3 → c3=1 ∧ b3+c3=1))) := by  have hcritical : (m+b0+b1+b2+b3+eb+6 ≤ 2*k) ∨      (b0+b1+b2+b3+eb+5 = 2*k ∧ m ≤ 1 ∧        (if 1 ≤ b0 then 1 else 0) + (if 1 ≤ b1 then 1 else 0) +        (if 1 ≤ b2 then 1 else 0) + (if 1 ≤ b3 then 1 else 0) + m ≤ 1) := by    by_cases h : b0+b1+b2+b3+eb+5 < 2*k    · exact Or.inl (hcrit.1 h)    · have heq : b0+b1+b2+b3+eb+5 = 2*k := by omega      exact Or.inr ⟨heq, hcrit.2 heq⟩  clear hcrit  rcases hcritical with hpos | hfull  all_goals rcases he2 with h2 | h2 <;> rcases he3 with h3 | h3  all_goals obtain ⟨t0, ht0⟩ := hodd0  all_goals obtain ⟨t1, ht1⟩ := hodd1  all_goals simp_all  all_goals first | omega | (split_ifs at * <;> omega)theorem five_odd_saturated_small_shore_aggregate_patterns    (k c m eb : ℕ) (g : Fin 4 → Fin 4 → ℕ)    (hc : 7 ≤ c) (hkc : c ≤ k)    (hEB : m ≤ eb)    (hzero : ∀ j : Fin 4, j ≠ 0 → g j 0 = 0 ∧ g j 3 = 0)    (hgroup0 : Odd (∑ b : Fin 4, g 0 b))    (hgroup1 : Odd (∑ b : Fin 4, g 1 b))    (hgroupE : ∀ j : Fin 4, j = 2 ∨ j = 3 →      (g j 2 = 0 ∧ g j 1 = 0) ∨ 1 ≤ g j 2)    (hroot : 1 ≤ g 0 0 ∧ g 0 0 ≤ 2 ∧ 1 ≤ g 1 2)    (hcounts : let s := m + (if 1 ≤ g 2 2 then 1 else 0) + (if 1 ≤ g 3 2 then 1 else 0);      let sz : Fin 4 → ℕ := ![5, 2*k-5, c, 2*k-c];      let tot : Fin 4 → ℕ := fun b => (∑ j : Fin 4, g j b) + (if b = 1 then eb else 0);      s+1 ≤ c ∧ s+1 ≤ k ∧ (∀ b, tot b ≤ sz b) ∧      (∑ b : Fin 4, tot b) + s = 2*k ∧ g 1 2 + g 2 2 + g 3 2 ≤ 3 ∧      (∑ j ∈ (Finset.univ : Finset (Fin 4)).erase 0, (g j 0 + g j 2 + g j 3)) ≤ 3 ∧      (∑ j ∈ (Finset.univ : Finset (Fin 4)).erase 1, (g j 0 + g j 1 + g j 2)) + eb + 2 ≤ c)    (hrep : let sz : Fin 4 → ℕ := ![5, 2*k-5, c, 2*k-c];      let forbid : Fin 4 → Fin 4 := ![1,0,3,2];      let tot : Fin 4 → ℕ := fun b => (∑ j : Fin 4, g j b) + (if b = 1 then eb else 0);      ∀ j b : Fin 4,        (if (j = 0 ∧ b = 0) ∨ (j = 1 ∧ b = 2) then 2 else 1) ≤ g j b →        (∑ t ∈ (Finset.univ : Finset (Fin 4)).erase (forbid b), (tot t - g j t)) + 3 ≤ sz b)    (hcuts : let sz : Fin 4 → ℕ := ![5, 2*k-5, c, 2*k-c];      let tot : Fin 4 → ℕ := fun b => (∑ j : Fin 4, g j b) + (if b = 1 then eb else 0);      (∀ j b : Fin 4, (b = 1 ∨ b = 3) → 1 ≤ g j b →        g j b + (tot 1 - g j 1) + (tot 3 - g j 3) ≤ sz b) ∧      (m > 0 → tot 1 + tot 3 ≤ sz 1) ∧      (∀ j : Fin 4,        (1 ≤ g j 0 - (if j = 0 then 1 else 0) →          g j 0 - (if j = 0 then 1 else 0) + (tot 3 - g j 3) ≤ 5) ∧        (1 ≤ g j 2 - (if j = 1 then 1 else 0) →          g j 2 - (if j = 1 then 1 else 0) + (tot 1 - g j 1) ≤ c) ∧        (1 ≤ tot 0 - g j 0 - (if j = 1 then 1 else 0) →          g j 0 + g j 2 + g j 3 + (tot 0 - g j 0 - (if j = 1 then 1 else 0)) ≤ 5 + (tot 1 - g j 1)) ∧        (1 ≤ tot 2 - g j 2 - (if j = 0 then 1 else 0) →          g j 0 + g j 1 + g j 2 + (tot 2 - g j 2 - (if j = 0 then 1 else 0)) ≤ c + (tot 3 - g j 3))))    (hcrit : let sz : Fin 4 → ℕ := ![5, 2*k-5, c, 2*k-c];      let tot : Fin 4 → ℕ := fun b => (∑ j : Fin 4, g j b) + (if b = 1 then eb else 0);      let groups : Fin 4 → ℕ := fun b => (∑ j : Fin 4, if 1 ≤ g j b then 1 else 0) + (if b = 1 then m else 0);      (tot 1 < sz 1 → m + tot 1 + 1 ≤ sz 1) ∧        (tot 1 = sz 1 → m ≤ 1 ∧ groups 1 ≤ 1))    (hconnected : (g 0 0 = 1 → g 0 2 + g 0 3 = 0 → g 0 1 = 0) ∧      (g 1 2 = 1 → g 1 0 + g 1 1 = 0 → g 1 3 = 0)) :    g 0 0 = 1 ∧      ((g 1 2 = 3 ∧ g 2 2 + g 3 2 = 0 ∧        (g 0 1 + g 0 2 + g 2 1 + g 2 2 + g 3 1 + g 3 2 + eb) + 4 = c) ∨       (g 1 2 = 1 ∧ g 2 2 + g 3 2 = 2 ∧        (∀ j : Fin 4, j = 2 ∨ j = 3 → 1 ≤ g j 2 → g j 2 = 1 ∧ (∑ b : Fin 4, g j b) = 1))) := by  classical  have hz10 := (hzero 1 (by decide)).1  have hz20 := (hzero 2 (by decide)).1  have hz30 := (hzero 3 (by decide)).1  have hz13 := (hzero 1 (by decide)).2  have hz23 := (hzero 2 (by decide)).2  have hz33 := (hzero 3 (by decide)).2  have e0 : (Finset.univ : Finset (Fin 4)).erase 0 = {1,2,3} := by decide  have e1 : (Finset.univ : Finset (Fin 4)).erase 1 = {0,2,3} := by decide  have e3 : (Finset.univ : Finset (Fin 4)).erase 3 = {0,1,2} := by decide  have ho0 : Odd (g 0 0 + g 0 1 + g 0 2 + g 0 3) := by simpa [Fin.sum_univ_four] using hgroup0  have ho1 : Odd (g 1 1 + g 1 2) := by simpa [Fin.sum_univ_four,hz10,hz13] using hgroup1  have he2 : (g 2 2=0 ∧ g 2 1=0) ∨ 1 ≤ g 2 2 := hgroupE 2 (Or.inl rfl)  have he3 : (g 3 2=0 ∧ g 3 1=0) ∨ 1 ≤ g 3 2 := hgroupE 3 (Or.inr rfl)  have hs : m + (if 1 ≤ g 2 2 then 1 else 0) + (if 1 ≤ g 3 2 then 1 else 0) + 1 ≤ c := hcounts.1  have hb : g 0 1+g 1 1+g 2 1+g 3 1+eb+5 ≤ 2*k := by    have hh := hcounts.2.2.1 (1 : Fin 4)    simp [Fin.sum_univ_four] at hh    omega  have ht : g 0 0+g 0 1+g 1 1+g 2 1+g 3 1+eb+g 0 2+g 1 2+g 2 2+g 3 2+g 0 3+m+      (if 1 ≤ g 2 2 then 1 else 0)+(if 1 ≤ g 3 2 then 1 else 0)=2*k := by    have hh := hcounts.2.2.2.1    simp [Fin.sum_univ_four,hz10,hz20,hz30,hz13,hz23,hz33] at hh    omega  have hsmall : g 1 2+g 2 2+g 3 2≤3 := hcounts.2.2.2.2.1  have hry : g 0 0+g 0 1+g 0 2+g 2 1+g 2 2+g 3 1+g 3 2+eb+2≤c := by    have hh := hcounts.2.2.2.2.2.2    simp [e1,Fin.sum_univ_four,hz10,hz20,hz30,hz13,hz23,hz33] at hh    omega  have hrA : 2≤g 0 0 → g 1 2+g 2 2+g 3 2≤2 := by    intro h    have hh := hrep 0 0 (by simpa using h)    dsimp at hh    simp [e0,e1,e3,Fin.sum_univ_four,hz10,hz20,hz30,hz13,hz23,hz33] at hh    omega  have hr0 : 1≤g 0 2 → g 1 1+g 2 1+g 3 1+eb+g 1 2+g 2 2+g 3 2+3≤c := by    intro h    have hh := hrep 0 2 (by simpa using h)    dsimp at hh    simp [e0,e1,e3,Fin.sum_univ_four,hz10,hz20,hz30,hz13,hz23,hz33] at hh    omega  have hcd : 1≤g 0 3 → g 0 3+g 1 1+g 2 1+g 3 1+eb+c≤2*k := by    intro h    have hh := hcuts.1 0 3 (Or.inr rfl) h    dsimp at hh    simp [e0,e1,e3,Fin.sum_univ_four,hz10,hz20,hz30,hz13,hz23,hz33] at hh    omega  have hr1 : 2≤g 1 2 → g 0 0+g 0 1+g 2 1+g 3 1+eb+g 0 2+g 2 2+g 3 2+3≤c := by    intro h    have hh := hrep 1 2 (by simpa using h)    dsimp at hh    simp [e0,e1,e3,Fin.sum_univ_four,hz10,hz20,hz30,hz13,hz23,hz33] at hh    omega  have hr2 : 1≤g 2 2 → g 0 0+g 0 1+g 1 1+g 3 1+eb+g 0 2+g 1 2+g 3 2+3≤c := by    intro h    have hh := hrep 2 2 (by simpa using h)    dsimp at hh    simp [e0,e1,e3,Fin.sum_univ_four,hz10,hz20,hz30,hz13,hz23,hz33] at hh    omega  have hr3 : 1≤g 3 2 → g 0 0+g 0 1+g 1 1+g 2 1+eb+g 0 2+g 1 2+g 2 2+3≤c := by    intro h    have hh := hrep 3 2 (by simpa using h)    dsimp at hh    simp [e0,e1,e3,Fin.sum_univ_four,hz10,hz20,hz30,hz13,hz23,hz33] at hh    omega  have hcrit' : (g 0 1+g 1 1+g 2 1+g 3 1+eb+5<2*k →      m+g 0 1+g 1 1+g 2 1+g 3 1+eb+6≤2*k) ∧    (g 0 1+g 1 1+g 2 1+g 3 1+eb+5=2*k → m≤1 ∧      (if 1≤g 0 1 then 1 else 0)+(if 1≤g 1 1 then 1 else 0)+      (if 1≤g 2 1 then 1 else 0)+(if 1≤g 3 1 then 1 else 0)+m≤1) := by    constructor    · intro h      have hh := hcrit.1      simp [Fin.sum_univ_four] at hh      have hh' := hh (by omega)      omega    · intro h      have hh := hcrit.2      dsimp at hh      simp only [Fin.sum_univ_four] at hh      exact hh (by omega)  have hr := in1158_small_odd_endpoint_arithmetic k c m eb (g 0 0) (g 0 1) (g 1 1) (g 2 1) (g 3 1)    (g 0 2) (g 1 2) (g 2 2) (g 3 2) (g 0 3) hc hkc hEB ⟨hroot.1,hroot.2.1⟩    hroot.2.2 he2 he3 ho0 ho1 hs hb ht hsmall hry hrA hr0 hcd hr1 hr2 hr3 hcrit' hconnected.1  rcases hr with ⟨ha, hcase | hcase⟩  · exact ⟨ha,Or.inl hcase⟩  · refine ⟨ha, Or.inr ⟨hcase.1,hcase.2.1,?_⟩⟩    intro j hj hjpos    rcases hj with rfl | rfl    · have hh := hcase.2.2.1 hjpos      simp [Fin.sum_univ_four,hz20,hz23]      omega    · have hh := hcase.2.2.2 hjpos      simp [Fin.sum_univ_four,hz30,hz33]      omega
See it in the graphDiscuss this resultChallenge it