Documentation

LeanPool.BrillNoetherGraphs.Utilities.Subdivision.SubdivisionArithmetic

Integer interpolation along a subdivided edge #

This file isolates the arithmetic needed to turn integral endpoint potentials into a convex integral potential on a path. It deliberately contains no graph construction.

For a positive length L and an integral rise T, write

T = q * L + r, with 0 <= r < L.

The potential below has slope q for the first L - r unit steps and slope q + 1 for the final r steps. Thus it has endpoint values 0 and T, and its slopes are nondecreasing. The sign convention is chosen for the future chip-firing application: at an interior path vertex, prin will be the next slope minus the previous slope.

The lower of the two slopes used to realize rise T over length L.

Equations
Instances For

    The number of final steps on which the slope is quotient L T + 1.

    Equations
    Instances For

      The integral offset at which the slope changes from q to q + 1.

      Equations
      Instances For

        The canonical unit slopes telescope to the difference of the endpoint values. Unlike potential_length, this identity is also meaningful at length zero.

        @[simp]

        The potential is normalized to zero at the tail endpoint.

        @[simp]

        The potential realizes the prescribed rise at the head endpoint.

        theorem Utilities.Certificate.SubdivisionArithmetic.sum_steps_eq_rise {L : ℕ} (T : ℤ) (hL : 0 < L) :
        ∑ i ∈ Finset.range L, step L T i = T

        On a nonempty block, the canonical unit slopes realize its declared rise. This is the telescoping fact used when concatenating piecewise blocks.

        Before the bend, the unit-step slope is exactly the quotient q.

        At and after the bend, the unit-step slope is q + 1.

        Every unit-step slope is one of the two consecutive integers q, q+1.

        theorem Utilities.Certificate.SubdivisionArithmetic.step_mono {L i j : ℕ} {T : ℤ} (hij : i ≤ j) :
        step L T i ≤ step L T j

        The two-slope sequence is nondecreasing.

        theorem Utilities.Certificate.SubdivisionArithmetic.lower_le_step_of_mul_le {L i : ℕ} (rise lo : ℤ) (hL : 0 < L) (hLower : lo * ↑L ≤ rise) :
        lo ≤ step L rise i

        A canonical unit slope is at least any declared lower endpoint bound whose total rise is feasible. This is the W2 arithmetic bridge used when a piecewise block contributes the outgoing slope at a merged boundary.

        theorem Utilities.Certificate.SubdivisionArithmetic.step_le_upper_of_le_mul {L i : ℕ} (rise hi : ℤ) (hL : 0 < L) (hiStep : i < L) (hUpper : rise ≤ hi * ↑L) :
        step L rise i ≤ hi

        A canonical unit slope is at most any declared upper endpoint bound whose total rise is feasible. The strict case uses the quotient bound; at equality the Euclidean remainder vanishes, so every genuine unit step is the quotient itself.

        Convexity in the form needed at an interior path vertex: the next slope minus the previous slope is nonnegative. Offset i + 1 is interior whenever i + 1 < L; the inequality itself holds without that extra restriction.

        Centered form of secondDifference_nonneg, ready to identify with prin at a positive interior offset.

        The first slope is the Euclidean quotient.

        The final slope is q when the rise is divisible by the length and q + 1 otherwise.

        theorem Utilities.Certificate.SubdivisionArithmetic.lastStep_eq_neg_ediv_neg {L : ℕ} (T : ℤ) (hL : 0 < L) :
        step L T (L - 1) = -(-T / ↑L)

        Equivalently, the final slope is the ceiling of T / L, expressed using integer Euclidean division and no rational arithmetic.

        theorem Utilities.Certificate.SubdivisionArithmetic.endpointSlopeBounds {L : ℕ} (T alpha beta : ℤ) (hL : 0 < L) (hlower : alpha * ↑L ≤ T) (hupper : T ≤ -beta * ↑L) :
        alpha ≤ step L T 0 ∧ beta ≤ -step L T (L - 1)

        Lower bounds on the two outgoing endpoint slopes follow from the homogeneous rise bounds used by local subdivision certificates.

        Closed arithmetic regressions #

        A negative, nondivisible rise uses the floor quotient first and the next integer on the remaining steps.

        A negative rise divisible by the path length has constant slope.

        On a path of length one, the unique step realizes every integral rise.

        A path with equal endpoint potentials has zero slope on each of its actual unit steps.

        A truncated negative ramp #

        The loop lemma needs the potential of rise -k along a path of length L, where 0 < k ≤ L. It falls with slope -1 for exactly k steps and is constant afterwards. Thus it places one unit of Laplacian at distance k from the zero endpoint (unless that point is the far endpoint).

        theorem Utilities.Certificate.SubdivisionArithmetic.quotient_neg_eq_neg_one {L k : ℕ} (hk : 0 < k) (hkL : k ≤ L) :
        quotient L (-↑k) = -1

        Euclidean division of -k by a positive L, for 0 < k ≤ L.

        theorem Utilities.Certificate.SubdivisionArithmetic.remainder_neg_eq_sub {L k : ℕ} (hk : 0 < k) (hkL : k ≤ L) :
        remainder L (-↑k) = ↑L - ↑k

        The complementary remainder in the same negative division.

        theorem Utilities.Certificate.SubdivisionArithmetic.bend_neg_eq {L k : ℕ} (hk : 0 < k) (hkL : k ≤ L) :
        bend L (-↑k) = ↑k

        The unique bend of the truncated negative ramp is at offset k.

        theorem Utilities.Certificate.SubdivisionArithmetic.step_neg_eq_ite {L k i : ℕ} (hk : 0 < k) (hkL : k ≤ L) :
        step L (-↑k) i = if i < k then -1 else 0

        The truncated negative ramp has slope -1 before k and zero from k onwards.