AFTD Auto-Formalizing Theoretical Domains

rat_abs_half_sum_add_abs_half_diff_le

theoremverified

If the absolute values of rational numbers p and q are at most M, the sum of the absolute values of (p+q)/2 and (p-q)/2 is at most M.

Statement

theorem rat_abs_half_sum_add_abs_half_diff_le (p q M : ℚ)
    (hp : |p| ≤ M) (hq : |q| ≤ M) : |(p+q)/2| + |(p-q)/2| ≤ M
Source
Helper for digraph_both_cuts_ge_ceil_div_six_of_indegree_lt, arXiv:2610.21381, proof of Theorem 1.4, Case 2. The two-partition certificate and paired-outcome inequality are a deterministic formulation of the paper's averaging argument; no research advance is claimed.
Verified
24 Oct 2026
Axioms
Classical.choiceQuot.soundpropext

The proof, explained

The proof first unpacks the assumptions |p| ≤ M and |q| ≤ M into bilateral bounds -M ≤ p ≤ M and -M ≤ q ≤ M. It then establishes the key inequality |p + q| + |p - q| ≤ 2 * M via a four-way case analysis on the signs of p + q and p - q, in each case removing absolute values and applying linear arithmetic. Finally, it factors division by 2 out of the absolute values and halves the key inequality to conclude that |(p + q) / 2| + |(p - q) / 2| ≤ M.

  1. -M ≤ p ≤ M and -M ≤ q ≤ M

    Applying `abs_le.mp` to the hypotheses |p| ≤ M and |q| ≤ M unfolds the absolute value bounds into the two-sided inequalities -M ≤ p ≤ M and -M ≤ q ≤ M.

    lines 3–4

    uses abs_le.mp

      have hp' := abs_le.mp hp
      have hq' := abs_le.mp hq
  2. |p + q| + |p - q| ≤ 2 * M

    We establish this auxiliary inequality by case analysis on the signs of p + q and p - q, using `le_total` to decide whether each quantity is non-negative or non-positive. In each of the four cases, we rewrite the absolute values with `abs_of_nonneg` or `abs_of_nonpos`. The sum |p + q| + |p - q| then simplifies algebraically to 2p, 2q, -2q, or -2p, respectively, each of which is at most 2M by linear arithmetic (`linarith`) given the bounds -M ≤ p ≤ M and -M ≤ q ≤ M.

    lines 5–16

    uses le_total, abs_of_nonneg, abs_of_nonpos

      have hh : |p+q| + |p-q| ≤ 2*M := by
        rcases le_total 0 (p+q) with ha | ha
        · rcases le_total 0 (p-q) with hb | hb
          · rw [abs_of_nonneg ha, abs_of_nonneg hb]
            linarith
          · rw [abs_of_nonneg ha, abs_of_nonpos hb]
            linarith
        · rcases le_total 0 (p-q) with hb | hb
          · rw [abs_of_nonpos ha, abs_of_nonneg hb]
            linarith
          · rw [abs_of_nonpos ha, abs_of_nonpos hb]
            linarith
  3. |(p + q) / 2| + |(p - q) / 2| ≤ M

    Rewriting with `abs_div` distributes the absolute values across division by 2, giving |p + q| / |2| + |p - q| / |2| ≤ M. Evaluating |2| = 2 via `norm_num` leaves (|p + q| + |p - q|) / 2 ≤ M, which follows immediately by linear arithmetic (`linarith`) from the auxiliary bound |p + q| + |p - q| ≤ 2 * M.

    lines 17–19

    uses abs_div

      rw [abs_div, abs_div]
      norm_num
      linarith
abs_le.mp
An absolute value inequality |x| ≤ B implies the two-sided inequality -B ≤ x ≤ B.
le_total
For any elements a and b in a linear order, either a ≤ b or b ≤ a.
abs_of_nonneg
If a ≥ 0, then |a| = a.
abs_of_nonpos
If a ≤ 0, then |a| = -a.
abs_div
The absolute value of a quotient is the quotient of the absolute values: |a / b| = |a| / |b|.

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

theorem rat_abs_half_sum_add_abs_half_diff_le (p q M : ℚ)    (hp : |p| ≤ M) (hq : |q| ≤ M) : |(p+q)/2| + |(p-q)/2| ≤ M := by  have hp' := abs_le.mp hp  have hq' := abs_le.mp hq  have hh : |p+q| + |p-q| ≤ 2*M := by    rcases le_total 0 (p+q) with ha | ha    · rcases le_total 0 (p-q) with hb | hb      · rw [abs_of_nonneg ha, abs_of_nonneg hb]        linarith      · rw [abs_of_nonneg ha, abs_of_nonpos hb]        linarith    · rcases le_total 0 (p-q) with hb | hb      · rw [abs_of_nonpos ha, abs_of_nonneg hb]        linarith      · rw [abs_of_nonpos ha, abs_of_nonpos hb]        linarith  rw [abs_div, abs_div]  norm_num  linarith
See it in the graphDiscuss this resultChallenge it