Documentation

Linglib.Core.Scales.EpistemicScale.Cancellation

Fourier-Motzkin Elimination, Farkas' Lemma, and Cancellation #

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.

Cancellation conditions for comparative probability #

@cite{kraft-pratt-seidenberg-1959}

Scott's cancellation framework for representability of comparative probability orderings by finitely additive measures. A comparative probability ordering ≿ is representable by a finitely additive measure iff it satisfies the cancellation property: no valid neutral portfolio has a strict member.

The hard direction (cancellation → representable) is an instance of LP duality / Farkas' lemma: the feasibility polytope {p ≥ 0 : Σpᵢ = 1, ordering constraints} is nonempty iff no dual certificate of infeasibility exists, and such a certificate corresponds exactly to a neutral portfolio with a strict member.

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 Core.Scale.comparisonVec (n : ) (A B : Finset (Fin n)) :
                      Fin n

                      Characteristic vector of a disjoint comparison: χ_A - χ_B ∈ {-1,0,1}ⁿ

                      Equations
                      Instances For

                        A weighted comparison: a disjoint pair (A,B) with positive rational weight.

                        Instances For

                          A portfolio is a list of weighted comparisons.

                          Equations
                          Instances For

                            The weighted sum of comparison vectors at atom i.

                            Equations
                            Instances For

                              A portfolio is neutral if weighted vectors sum to zero at every atom.

                              Equations
                              Instances For
                                def Core.Scale.Portfolio.isValid {n : } (P : Portfolio n) (ge : Set (Fin n)Set (Fin n)Prop) :

                                A portfolio is valid for an ordering if each comparison holds.

                                Equations
                                Instances For
                                  def Core.Scale.Portfolio.hasStrict {n : } (P : Portfolio n) (ge : Set (Fin n)Set (Fin n)Prop) :

                                  A portfolio has a strict member if at least one comparison is strict.

                                  Equations
                                  Instances For
                                    def Core.Scale.Cancellation (n : ) (ge : Set (Fin n)Set (Fin n)Prop) :

                                    The cancellation property: no valid neutral portfolio has a strict member.

                                    Equations
                                    Instances For
                                      theorem Core.Scale.representable_implies_cancellation {n : } (sys : EpistemicSystemFA (Fin n)) (m : FinAddMeasure (Fin n)) (hm : ∀ (A B : Set (Fin n)), sys.ge A B m.inducedGe A B) :

                                      Easy direction: If μ represents the ordering, no neutral portfolio has a strict member. Each comparison contributes wⱼ·(μ(Aⱼ)−μ(Bⱼ)) ≥ 0 to the portfolio value; if any is strict, the value is positive. But by the interchange lemma, the value also equals Σᵢ μ({i})·weightedSum(i) = 0 by neutrality.

                                      The feasibility polytope for measure representation: probability vectors p : Fin n → ℚ that are nonneg, normalized, and faithfully encode the ordering on disjoint pairs — exactly sys.ge ↑A ↑B ↔ A.sum p ≥ B.sum p. The ↔ (rather than →) is essential: the forward direction ensures the measure respects the ordering, while the backward direction ensures strictness is preserved (no spurious ties).

                                      Equations
                                      Instances For
                                        theorem Core.Scale.cancellation_implies_representable {n : } (sys : EpistemicSystemFA (Fin n)) (hcancel : Cancellation n sys.ge) :
                                        ∃ (m : FinAddMeasure (Fin n)), ∀ (A B : Set (Fin n)), sys.ge A B m.inducedGe A B

                                        Scott's theorem (hard direction): if no valid neutral portfolio has a strict member, then a finitely additive measure exists representing the ordering. Decomposes into two steps:

                                        1. cancellation_nonempty: Farkas / LP duality shows the feasibility polytope is nonempty when cancellation holds.
                                        2. feasible_to_measure: a feasible weight vector constructs a representing FinAddMeasure.

                                        FA on Fin 3 implies the cancellation property. Derived from the direct measure construction (theorem8a_fin3 in Defs.lean) composed with the easy direction of Scott's theorem.

                                        theorem Core.Scale.not_all_null_fin4 (sys : EpistemicSystemFA (Fin 4)) (h0 : sys.ge {0}) (h1 : sys.ge {1}) (h2 : sys.ge {2}) (h3 : sys.ge {3}) :

                                        Not all 4 singletons can be null (non-triviality).

                                        theorem Core.Scale.fa_cancellation_fin4_null0 (sys : EpistemicSystemFA (Fin 4)) (h0 : sys.ge {0}) (hnn : ∃ (i : Fin 3), ¬sys.ge {i.succ}) :

                                        Helper: if element 0 is null on Fin 4, derive cancellation via null reduction to Fin 3.

                                        theorem Core.Scale.cancellation_from_weights {n : } (sys : EpistemicSystemFA (Fin n)) (p : Fin n) (hp : ∀ (i : Fin n), 0 < p i) (hsum : Finset.univ.sum p = 1) (hfwd : ∀ (A B : Finset (Fin n)), Disjoint A Bsys.ge A BA.sum p B.sum p) (hstrict : ∀ (A B : Finset (Fin n)), Disjoint A Bsys.ge A B¬sys.ge B AA.sum p > B.sum p) :

                                        Cancellation follows from a "forward + strict" witness: positive weights p summing to 1 such that every valid comparison has p-value ≥ 0 and every strict comparison has p-value > 0. This avoids constructing a full representing measure.

                                        theorem Core.Scale.cancellation_from_weights_fin4 (sys : EpistemicSystemFA (Fin 4)) (p : Fin 4) (hp : ∀ (i : Fin 4), 0 < p i) (hsum : Finset.univ.sum p = 1) (hnge : ∀ (A B : Finset (Fin 4)), Disjoint A BA.sum p < B.sum p¬sys.ge A B) (heq : ∀ (A B : Finset (Fin 4)), Disjoint A BA.sum p = B.sum psys.ge A Bsys.ge B A) :

                                        Wrapper around cancellation_from_weights that replaces the two universally-quantified obligations (hfwd, hstrict) with a single contrapositive condition: for every disjoint pair (A, B) where A.sum p < B.sum p, we have ¬sys.ge ↑A ↑B. Equal-sum pairs need bidirectionality (heq). The proof of cancellation_from_weights does the hfwd/hstrict dispatch once; each chamber only provides the ~5-10 ¬ge facts for "wrong-direction" pairs.

                                        theorem Core.Scale.ge_empty_contra (sys : EpistemicSystemFA (Fin 4)) (hpos : ∀ (i : Fin 4), ¬sys.ge {i}) {B : Set (Fin 4)} (hne : B.Nonempty) (h : sys.ge B) :

                                        ge(∅, B) is impossible when B is nonempty and ¬ge(∅, {i}) for all singletons.

                                        theorem Core.Scale.cancellation_from_pairs (sys : EpistemicSystemFA (Fin 4)) (p : Fin 4) (hp : ∀ (i : Fin 4), 0 < p i) (hsum : Finset.univ.sum p = 1) (hpos : ∀ (i : Fin 4), ¬sys.ge {i}) (lt_pairs : List (Finset (Fin 4) × Finset (Fin 4))) (hlt_cover : ∀ (A B : Finset (Fin 4)), A.NonemptyB.NonemptyDisjoint A BA.sum p < B.sum p(A, B) lt_pairs) (hlt : pairlt_pairs, ¬sys.ge pair.1 pair.2) (eq_pairs : List (Finset (Fin 4) × Finset (Fin 4))) (heq_cover : ∀ (A B : Finset (Fin 4)), A.NonemptyB.NonemptyDisjoint A BA.sum p = B.sum p(A, B) eq_pairs) (heq : paireq_pairs, sys.ge pair.1 pair.2sys.ge pair.2 pair.1) :

                                        Pre-computed pair variant of cancellation_from_weights_fin4. Instead of 256-case dispatch via finset_fin4_eq, the caller provides explicit lists of critical (A,B) pairs and proves coverage via native_decide. Empty-set cases are handled internally via ge_empty_contra.

                                        theorem Core.Scale.cancellation_from_generic_weights {n : } (sys : EpistemicSystemFA (Fin n)) (p : Fin n) (hp : ∀ (i : Fin n), 0 < p i) (hsum : Finset.univ.sum p = 1) (hfwd : ∀ (A B : Finset (Fin n)), Disjoint A Bsys.ge A BA.sum p B.sum p) (hgeneric : ∀ (A B : Finset (Fin n)), Disjoint A BA.sum p = B.sum pA = B = ) :

                                        When weights are generic (no two nonempty disjoint subsets have equal sum), cancellation reduces to a single forward obligation: sys.ge ↑A ↑B → A.sum p ≥ B.sum p. The strict direction and equal-sum bidirectionality are both free:

                                        • strict: contrapositive of hfwd (if A.sum p < B.sum p then ¬sys.ge ↑A ↑B)
                                        • heq: vacuously true (genericity rules out equal-sum disjoint pairs)
                                        theorem Core.Scale.finset_fin4_eq (S : Finset (Fin 4)) :
                                        S = S = {0} S = {1} S = {2} S = {3} S = {0, 1} S = {0, 2} S = {0, 3} S = {1, 2} S = {1, 3} S = {2, 3} S = {0, 1, 2} S = {0, 1, 3} S = {0, 2, 3} S = {1, 2, 3} S = Finset.univ

                                        Classify all Finset (Fin 4) into one of 16 explicit values.

                                        theorem Core.Scale.nge_13_02 (sys : EpistemicSystemFA (Fin 4)) (h01 : sys.ge {0} {1}) (h23 : sys.ge {2} {3}) (h : ¬sys.ge {1} {0} ¬sys.ge {3} {2}) :
                                        ¬sys.ge {1, 3} {0, 2}

                                        ¬ge({1,3}, {0,2}) from singleton hypotheses via additive decomposition. Route A (¬ge({1},{0})): ge({1,3},{0,2}) → additive ge({0,2},{0,3}) via ge({2},{3}) → trans → ge({1,3},{0,3}) → additive → ge({1},{0}) → contradiction. Route B (¬ge({3},{2})): ge({1,3},{0,2}) → additive ge({0,2},{1,2}) via ge({0},{1}) → trans → ge({1,3},{1,2}) → additive → ge({3},{2}) → contradiction.

                                        theorem Core.Scale.nge_23_01 (sys : EpistemicSystemFA (Fin 4)) (h12 : sys.ge {1} {2}) (h23 : sys.ge {2} {3}) (h01 : sys.ge {0} {1}) (h : ¬sys.ge {2} {0} ¬sys.ge {3} {1}) :
                                        ¬sys.ge {2, 3} {0, 1}

                                        ¬ge({2,3}, {0,1}) from singleton hypotheses via additive decomposition. Route A (¬ge({2},{0})): ge({2,3},{0,1}) → additive ge({0,1},{0,3}) via ge({1},{3}) → trans → ge({2,3},{0,3}) → additive → ge({2},{0}) → contradiction. Route B (¬ge({3},{1})): ge({2,3},{0,1}) → additive ge({0,1},{1,2}) via ge({0},{2}) → trans → ge({2,3},{1,2}) → additive → ge({3},{1}) → contradiction.

                                        theorem Core.Scale.perm_cancellation {n : } (σ : Fin n Fin n) (sys : EpistemicSystemFA (Fin n)) (hc : Cancellation n (transportFA σ sys).ge) :

                                        Cancellation transfers through permutations (via representability).

                                        theorem Core.Scale.theorem8a_fin3' (sys : EpistemicSystemFA (Fin 3)) :
                                        ∃ (m : FinAddMeasure (Fin 3)), ∀ (A B : Set (Fin 3)), sys.ge A B m.inducedGe A B

                                        Theorem 8a for Fin 3 (via cancellation): every FA system on Fin 3 is representable by a finitely additive probability measure.