Documentation

LeanPool.DistinctDistances.RationalFarkasRows

Rational rows and their sound integer scaling #

Rational linear inequalities are scaled by a common denominator before the packed Farkas checker consumes them. Successful conversion preserves every satisfied row.

Rational rows #

structure Esgk.S4.QRow :

A rational row ∑_{(k, q) ∈ ent} q * v k ≤ rhs.

  • ent : List (ℕ × ℚ)

    the entries (variable, coefficient); an index may repeat

  • rhs : ℚ

    the right-hand side

Instances For
    noncomputable def Esgk.S4.QRow.lhs (r : QRow) (v : ℕ → ℝ) :

    The left-hand side of a rational row at v.

    Equations
    Instances For
      def Esgk.S4.QRow.Holds (r : QRow) (v : ℕ → ℝ) :

      The point v satisfies the rational row r.

      Equations
      Instances For

        Scaling a rational row to an integer row #

        noncomputable def Esgk.S4.QRow.den (r : QRow) :

        The lcm of the denominators of the entries and of the right-hand side.

        Equations
        Instances For
          noncomputable def Esgk.S4.allInt (L : ℕ) (E : List (ℕ × ℚ)) :

          Every entry times L is an integer.

          Equations
          Instances For
            noncomputable def Esgk.S4.posPart (L : ℕ) (E : List (ℕ × ℚ)) :

            The positive entries times L.

            Equations
            Instances For
              noncomputable def Esgk.S4.negPart (L : ℕ) (E : List (ℕ × ℚ)) :

              The negative entries times -L.

              Equations
              Instances For
                def Esgk.S4.QRow.scaleNumerator (denominator : ℕ) (value : ℚ) :

                The exact integer coefficient when the given denominator clears the rational.

                Equations
                Instances For
                  noncomputable def Esgk.S4.QRow.signedEntries (keep : ℚ → Bool) (numerator : ℚ → ℤ) (entries : List (ℕ × ℚ)) :

                  Collect selected integer coefficients in the original row order.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For

                    Scale the row by its common denominator to obtain integer coefficients.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      theorem Esgk.S4.QRow.toRow_sound {r : QRow} {R : FarkasPackedCheck.Row} {v : ℕ → ℝ} (h : r.toRow = some R) (hr : r.Holds v) :
                      R.Holds v

                      Soundness of the scaling: the integer row holds wherever the rational row holds.