Documentation

Linglib.Core.Polyhedral.FourierMotzkin

Fourier-Motzkin Elimination and Farkas' Lemma over ℚ #

Fourier-Motzkin (FM) elimination is a variable-elimination procedure for rational linear inequalities: given a system Ax ≤ b in n+1 variables, eliminate the last variable by combining pairs of constraints (one with positive last coefficient, one with negative) to produce an equisatisfiable system in n variables.

From FM equisatisfiability we derive Farkas' lemma over ℚ: a rational linear system is either feasible or admits a nonneg certificate of infeasibility. This is the core duality theorem for rational linear programming — no topology, no completeness, no ℝ detour.

The conceptual backbone is the Minkowski-Weyl theorem for rational cones (H-cone = V-cone), of which Farkas is an immediate corollary.

Main results #

def Polyhedral.dot {n : } (u v : Fin n) :

Dot product of two rational vectors indexed by Fin n.

Equations
Instances For
    structure Polyhedral.Ineq (n : ) :

    A linear inequality constraint: lhs · x ≤ rhs.

    Instances For
      def Polyhedral.Ineq.sat {n : } (c : Ineq n) (x : Fin n) :

      A constraint is satisfied by a point x when lhs · x ≤ rhs.

      Equations
      Instances For
        @[reducible, inline]
        abbrev Polyhedral.System (n : ) :

        A system of linear inequalities (a list of constraints).

        Equations
        Instances For

          A system is feasible if some point satisfies every constraint.

          Equations
          Instances For
            def Polyhedral.Ineq.lastCoeff {n : } (c : Ineq (n + 1)) :

            The last coefficient of a constraint in n+1 variables.

            Equations
            Instances For
              def Polyhedral.Ineq.project {n : } (c : Ineq (n + 1)) :

              Project a constraint to n variables (dropping the last coefficient).

              Equations
              Instances For
                def Polyhedral.Ineq.combine {n : } (cp cn : Ineq (n + 1)) :

                Combine a positive-last and negative-last constraint, eliminating the last variable.

                Equations
                Instances For
                  def Polyhedral.fmElim {n : } (S : System (n + 1)) :

                  One step of FM elimination: partition constraints by sign of the last coefficient, project the zero ones, combine all positive × negative pairs.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    theorem Polyhedral.fmElim_equisat {n : } (S : System (n + 1)) :

                    FM equisatisfiability: the original system (n+1 variables) is feasible iff the reduced system (n variables) is feasible.

                    Forward: project out last coordinate. Backward: find t in the interval defined by positive (upper bound) and negative (lower bound) constraints; the P×N combinations guarantee the interval is nonempty.

                    structure Polyhedral.InfeasCert {n : } (S : System n) :

                    An infeasibility certificate: nonneg weights (indexed by constraint position) such that the weighted combination of constraints yields 0·x ≤ negative.

                    Instances For

                      Farkas' lemma over ℚ: a rational linear system is either feasible or has a nonneg certificate of infeasibility.

                      Proof by induction on n (number of variables), using FM elimination. Base case (0 variables): each constraint is 0 ≤ rhs. Inductive step: FM-eliminate → IH → extend backward or lift certificate.

                      def Polyhedral.conicHull {n : } (gens : List (Fin n)) :
                      Set (Fin n)

                      The conic hull of a finite set of rational generators.

                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        def Polyhedral.hCone {n : } (normals : List (Fin n)) :
                        Set (Fin n)

                        A rational polyhedral cone (H-description).

                        Equations
                        Instances For
                          theorem Polyhedral.minkowskiWeyl_VtoH {n : } (gens : List (Fin n)) :
                          ∃ (normals : List (Fin n)), conicHull gens = hCone normals

                          Minkowski-Weyl (V→H): every finitely generated rational cone is polyhedral.

                          theorem Polyhedral.minkowskiWeyl_HtoV {n : } (normals : List (Fin n)) :
                          ∃ (gens : List (Fin n)), hCone normals = conicHull gens

                          Minkowski-Weyl (H→V): every rational polyhedral cone is finitely generated.