Documentation

Linglib.Phonology.HarmonicGrammar.ViolationSemiring

Violation Semiring — OT/HG Unification #

[Rig09b]

OT and HG are instances of a single algebraic framework: evaluation over a commutative semiring. Violation profiles form a commutative semiring V (the violation semiring); real-valued costs form the standard tropical semiring T. HG weights define a structure-preserving map from V to T.

The two semirings (Example 2 of [Rig09b]) #

V = Tropical (WithTop (ViolationProfile n)) — the violation semiring:

T = Tropical (WithTop ℝ≥0) — the tropical semiring:

OT evaluates in V; HG evaluates in T. The weight assignment w : Fin n → ℝ induces a map V → T via the weighted sum v ↦ Σ wᵢ · vᵢ. This map always preserves ⊗ (merge/tropical multiplication — linearity of the dot product). It preserves ⊕ (min/tropical addition) when weights are exponentially separated — which is exactly the content of the HG–OT agreement theorem ([SL06], formalized in HarmonicGrammar.OTLimit).

Monotonicity (Dijkstra's Principle) #

In both V and T, merging violations can only make things worse: ∀ a b, a ≤ a ⊎ b. This is the property that makes shortest-path algorithms applicable to OT optimization. Riggle: "every subpath of an optimal input–output mapping is itself an optimal mapping."

The Violation Semiring V #

@[reducible, inline]

The violation semiring ([Rig09b] Definition 2, Example 2): Tropical (WithTop (ViolationProfile n)) for n ranked constraints.

Tropical addition (⊕) is min under harmonic inequality. Tropical multiplication (⊗) is componentwise violation addition. The semiring structure is derived, not stipulated: ViolationProfile n = Lex (Fin n → Nat) carries LinearOrder (from Pi.Lex), AddCommMonoid (componentwise), and IsOrderedCancelAddMonoid, and mathlib's Tropical/WithTop wrappers do the rest.

Equations
Instances For
    @[implicit_reducible]
    noncomputable instance HarmonicGrammar.ViolationSemiring.instCommSemiringVS (n : ) :
    CommSemiring (VS n)

    The violation semiring is a commutative semiring.

    Equations

    Monotonicity — Dijkstra's Principle #

    Dijkstra's principle for violation profiles ([Rig09b] §4, [Dij59]): merging violations can only make things worse (or keep them equal).

    In Riggle's terms: the ⊗ (merge) operator is monotone — A ⊗ B ≥ A for all violation profiles A, B. Equivalently, the ⊕ (min) operator is idempotent — A ⊕ A = A (min_self). An idempotent ⊕ together with a monotone ⊗ make the violation semiring an idempotent semiring (dioid) — the structure that makes shortest-path algorithms applicable to OT optimization: "every piece of an optimal input–output mapping is itself an optimal mapping."

    Weight Map V → ℝ (AddMonoidHom) #

    The weight map ([Rig09b] §4): an additive monoid homomorphism from the violation semiring's underlying monoid (ViolationProfile n, +, 0) to (ℝ, +, 0).

    Given weights w : Fin n → ℝ, the weight map sends a violation profile v to the weighted sum Σ wᵢ · vᵢ. This is the function that maps V to T — the violation semiring to the tropical semiring.

    Bundling as AddMonoidHom makes the homomorphism property (weight(a ⊎ b) = weight(a) + weight(b)) structural rather than propositional, and unlocks mathlib's homomorphism lemmas (map_sum, map_nsmul, etc.).

    Equivalently, this says the weight map preserves tropical multiplication (⊗) from V to T — always true by linearity of the dot product, regardless of weight magnitudes. The interesting condition (exponential separation) is needed for preserving tropical addition (⊕ = min) — see weightMap_strictMono.

    Equations
    Instances For

      Bridge to Existing HG Code #

      weightMap is definitionally equal to weightedViolations from HarmonicGrammar.OTLimit.

      This bridges the semiring-theoretic framework (violation profiles as algebraic objects) to the existing HG–OT agreement machinery (violation vectors as functions).

      Order-Preservation (⊕-compatibility) #

      theorem HarmonicGrammar.ViolationSemiring.weightMap_strictMono {n : } (w : Fin n) (M : ) (hw : ExponentiallySeparated w M) (a b : Constraints.ViolationProfile n) (hM : ∀ (i : Fin n), a i M b i M) (hab : a < b) :
      (weightMap w) a < (weightMap w) b

      The weight map is strictly order-preserving when weights are exponentially separated ([Rig09b] §4, [SL06] ch. 14):

      If a < b lexicographically and all violations are bounded by M, then weight(a) < weight(b).

      In tropical semiring terms: the weight map preserves tropical addition (⊕ = min) — it maps the lex-minimum in V to the numerical minimum in T. This is the content that exponential separation buys: the weight map is not just a monoid homomorphism (preserves ⊗ always, § 3) but an order-preserving monoid homomorphism (preserves ⊕ conditionally).

      The proof delegates to lex_imp_lower_violations from OTLimit.lean, which is stated over < on ViolationProfile directly.

      theorem HarmonicGrammar.ViolationSemiring.weightMap_mono {n : } (w : Fin n) (M : ) (hw : ExponentiallySeparated w M) (a b : Constraints.ViolationProfile n) (hM : ∀ (i : Fin n), a i M b i M) (hab : a b) :
      (weightMap w) a (weightMap w) b

      Non-strict monotonicity: a ≤ b lexicographically implies weight(a) ≤ weight(b) under exponential separation.

      theorem HarmonicGrammar.ViolationSemiring.weightMap_preserves_minimum {n : } (w : Fin n) (M : ) (hw : ExponentiallySeparated w M) (a : Constraints.ViolationProfile n) (S : Finset (Constraints.ViolationProfile n)) (ha : a S) (hmin : bS, a b) (hM : bS, ∀ (i : Fin n), b i M) (b : Constraints.ViolationProfile n) :
      b S(weightMap w) a (weightMap w) b

      The lex-minimum of a candidate set maps to the weight-minimum: the OT winner and HG winner coincide under exponential separation.

      This is the semiring-theoretic restatement of HG–OT agreement: argmin_V ↦ argmin_T when the weight map preserves both ⊗ and ⊕.