Documentation

Linglib.Theories.Phonology.OptimalityTheory.Constraints

Shared Phonological Constraint Library #

@cite{prince-smolensky-1993} @cite{mccarthy-prince-1995}

Reusable constraint constructors for Optimality Theory and Harmonic Grammar. Every phonological study in linglib defines constraints as NamedConstraint C or WeightedConstraint C instances. Many constraint families recur across studies with different candidate types:

This module provides generic constructors so that study files can write:

def myMax := mkMax "MAX-V" (fun c => c.deleted)

rather than manually assembling the NamedConstraint record each time. The constructors enforce the correct ConstraintFamily classification.

Contextual faithfulness #

Following @cite{coetzee-pater-2011}, contextual faithfulness constraints (e.g. MAX-PRE-V, MAX-FINAL) are standard MAX/DEP constraints with an additional context predicate. mkMaxCtx and mkDepCtx take a context guard: the constraint is violated only when the context guard is true.

Violation counting #

All constructors support both binary (0/1) and gradient (Nat) violations. Binary constraints use a Bool predicate; gradient constraints use a Nat-valued evaluation function directly.

def Phonology.Constraints.mkMax {C : Type} (name : String) (P : CProp) [DecidablePred P] :

Build a MAX constraint (penalizes deletion).

P c holds (as a proposition) when candidate c exhibits deletion. Decidable for the constraint to be evaluable.

Equations
Instances For
    def Phonology.Constraints.mkMaxCtx {C : Type} (name : String) (Deleted : CProp) [DecidablePred Deleted] (Context : CProp) [DecidablePred Context] :

    Build a contextual MAX constraint. Violated only when both deletion occurs AND the context holds. Models positional faithfulness (@cite{coetzee-pater-2011} §3.2).

    Equations
    Instances For
      def Phonology.Constraints.mkDep {C : Type} (name : String) (P : CProp) [DecidablePred P] :

      Build a DEP constraint (penalizes epenthesis). P c holds when candidate c exhibits insertion.

      Equations
      Instances For
        def Phonology.Constraints.mkIdent {C : Type} (name : String) (P : CProp) [DecidablePred P] :

        Build an IDENT constraint (penalizes featural change). P c holds when the feature value has changed.

        Equations
        Instances For
          def Phonology.Constraints.mkAnchorLeft {C : Type} (name : String) (P : CProp) [DecidablePred P] :

          Build a LEFT-ANCHOR constraint: the morpheme's tonal specification must be in correspondence with the left edge of the host. P c holds when the left anchor is not satisfied.

          Following @cite{finley-2009}: morpheme-specific versions of @cite{mccarthy-prince-1995}'s ANCHOR constraints.

          Equations
          Instances For
            def Phonology.Constraints.mkAnchorRight {C : Type} (name : String) (P : CProp) [DecidablePred P] :

            Build a RIGHT-ANCHOR constraint: the morpheme's tonal specification must be in correspondence with the right edge of the host.

            Equations
            Instances For
              def Phonology.Constraints.mkIntegrity {C : Type} (name : String) (P : CProp) [DecidablePred P] :

              Build an INTEGRITY constraint: the morpheme's tone must not have multiple correspondents in the output. Penalizes splitting of a single input tone across multiple output TBUs when the one-to-one mapping is violated.

              Equations
              Instances For

                Anchor-left constraints are faithfulness constraints.

                Anchor-right constraints are faithfulness constraints.

                Integrity constraints are faithfulness constraints.

                def Phonology.Constraints.mkForbidPairsOnTier {C α β : Type} (name : String) (R : ββProp) [DecidableRel R] (T : Core.Tier α β) (extract : CList α) :

                Build a markedness constraint penalizing tier-adjacent forbidden pairs. The candidate's raw symbol list is extracted by extract, the tier T projects it onto the relevant tier alphabet (an erasing string homomorphism — see Core.StringHom), and each tier-adjacent pair (a, b) with R a b contributes one violation.

                Generic markedness constructor for adjacency-based phonological constraints over a single tier. OCP is the case R := (· = ·) (mkOCPOnTier below). The TSL_2 bridge Phonology.Subregular.mkForbidPairsOnTier_zero_iff_in_lang characterizes zero-violation candidates as members of the corresponding tier-based strictly 2-local language for any choice of R.

                Equations
                Instances For
                  def Phonology.Constraints.mkForbidSingletonOnTier {C α β : Type} (name : String) (P : βProp) [DecidablePred P] (T : Core.Tier α β) (extract : CList α) :

                  Build a markedness constraint penalizing tier elements satisfying P. The SL_1 sibling of mkForbidPairsOnTier: each tier symbol a with P a contributes one violation. *Coda — viewed as "no segment in coda position survives the syllable-coda tier" — is the canonical SL_1 instance and should use this constructor rather than be shoehorned into the forbidden-pair schema. The TSL_1 / SL_1 language-side bridge is not yet wired; the constructor exists to keep SL_1 phenomena from silently masquerading as TSL_2.

                  Equations
                  Instances For
                    def Phonology.Constraints.adjacentIdentical {α : Type} [DecidableEq α] :
                    List α

                    Count adjacent identical pairs in a list. Definitional alias for countAdjacent (· = ·) — kept under this name because OCP-style constraints read more naturally with the linguistic-domain term.

                    Equations
                    Instances For
                      def Phonology.Constraints.mkOCP {C α : Type} [DecidableEq α] (name : String) (project : CList α) :

                      Build an OCP constraint: penalizes adjacent identical elements on a tier. project extracts the relevant tier from a candidate.

                      The OCP is parametrically polymorphic over the feature type α — it operates on identity vs. non-identity of adjacent elements, regardless of what kind of features they are. Following @cite{berent-2026}, this polymorphism captures the algebraic nature of phonological constraints: they generalize to novel feature values by construction.

                      Equations
                      Instances For
                        def Phonology.Constraints.mkOCPOnTier {C α β : Type} [DecidableEq β] (name : String) (T : Core.Tier α β) (extract : CList α) :

                        Build an OCP constraint from a Core.Tier projection. The candidate's raw symbol list is extracted by extract, and the tier T projects that string onto the relevant tier alphabet (an erasing string homomorphism — see Core.StringHom).

                        This is the constraint-algebra adapter for the unified Tier interface: autosegmental tonal-tier OCP, sibilant-harmony OCP, and learned-tier OCP (à la @cite{belth-2026}) all factor through this constructor.

                        Defined as the R := (· = ·) specialization of mkForbidPairsOnTier, mirroring mkAgreeOnTier's R := (· ≠ ·) specialization. The two sit in the same constraint algebra and the equivalence is rfl.

                        @cite{goldsmith-1976} @cite{berent-2026}

                        Equations
                        Instances For
                          def Phonology.Constraints.mkAgreeOnTier {C α β : Type} [DecidableEq β] (name : String) (T : Core.Tier α β) (extract : CList α) :

                          Build an AGREE constraint from a Core.Tier projection: penalizes each tier-adjacent pair (a, b) with a ≠ b. The non-identity dual of mkOCPOnTier. AGREE-style markedness in OT phonology is the symmetric specialization of mkForbidPairsOnTier with R := (· ≠ ·), just as the OCP is the R := (· = ·) specialization. The two specializations sit in the same constraint algebra; their consumers (consonant harmony, vowel harmony, dissimilation, anti-OCP) use the same machinery up to the choice of R.

                          Equations
                          Instances For
                            def Phonology.Constraints.mkAlign {C : Type} (name : String) (P : CProp) [DecidablePred P] :

                            Build a binary ALIGN constraint (markedness): violated when the candidate's edge configuration is wrong. The Generalized Alignment schema Align(Cat₁, Edge₁, Cat₂, Edge₂) (@cite{mccarthy-prince-1993}) is given here in its predicate-based form: the user supplies the predicate P c that holds when the edge configuration is misaligned.

                            Specific alignment instances include left/right edge alignment of morphological constituents to prosodic constituents and the *Misalignment principle of @cite{faust-2026} (root nonfinal element must not be template-final).

                            Equations
                            Instances For
                              def Phonology.Constraints.mkAlignGrad {C : Type} (name : String) (violations : C) :

                              Gradient ALIGN: counts edge-mismatch violations (@cite{mccarthy-prince-1993}).

                              Equations
                              Instances For
                                theorem Phonology.Constraints.mkMax_is_faithfulness {C : Type} (name : String) (P : CProp) [DecidablePred P] :

                                MAX constraints are faithfulness constraints.

                                theorem Phonology.Constraints.mkDep_is_faithfulness {C : Type} (name : String) (P : CProp) [DecidablePred P] :

                                DEP constraints are faithfulness constraints.

                                theorem Phonology.Constraints.mkMark_is_markedness {C : Type} (name : String) (P : CProp) [DecidablePred P] :

                                Markedness constraints are markedness constraints.

                                theorem Phonology.Constraints.mkMaxCtx_is_faithfulness {C : Type} (name : String) (D : CProp) [DecidablePred D] (Ctx : CProp) [DecidablePred Ctx] :

                                Contextual MAX constraints are faithfulness constraints.

                                theorem Phonology.Constraints.mkForbidPairsOnTier_is_markedness {C α β : Type} (name : String) (R : ββProp) [DecidableRel R] (T : Core.Tier α β) (extract : CList α) :

                                Forbidden-pair constraints are markedness constraints.

                                theorem Phonology.Constraints.mkAgreeOnTier_is_markedness {C α β : Type} [DecidableEq β] (name : String) (T : Core.Tier α β) (extract : CList α) :

                                AGREE constraints are markedness constraints.

                                theorem Phonology.Constraints.mkForbidSingletonOnTier_is_markedness {C α β : Type} (name : String) (P : βProp) [DecidablePred P] (T : Core.Tier α β) (extract : CList α) :

                                Forbidden-singleton constraints are markedness constraints.

                                theorem Phonology.Constraints.mkOCP_is_markedness {C α : Type} [DecidableEq α] (name : String) (project : CList α) :

                                OCP constraints are markedness constraints.

                                theorem Phonology.Constraints.mkOCPOnTier_is_markedness {C α β : Type} [DecidableEq β] (name : String) (T : Core.Tier α β) (extract : CList α) :

                                Tier-driven OCP constraints are markedness constraints.

                                theorem Phonology.Constraints.mkAlign_is_markedness {C : Type} (name : String) (P : CProp) [DecidablePred P] :

                                ALIGN constraints are markedness constraints (@cite{mccarthy-prince-1993}).

                                theorem Phonology.Constraints.mkMax_bounded {C : Type} (name : String) (P : CProp) [DecidablePred P] (c : C) :
                                (mkMax name P).eval c 1

                                Binary constraints have violations bounded by 1.

                                theorem Phonology.Constraints.mkMark_bounded {C : Type} (name : String) (P : CProp) [DecidablePred P] (c : C) :
                                (mkMark name P).eval c 1

                                Binary markedness constraints have violations bounded by 1.

                                theorem Phonology.Constraints.mkMaxCtx_bounded {C : Type} (name : String) (D : CProp) [DecidablePred D] (Ctx : CProp) [DecidablePred Ctx] (c : C) :
                                (mkMaxCtx name D Ctx).eval c 1

                                Contextual MAX constraints have violations bounded by 1.

                                def Phonology.Constraints.mkMaxW {C : Type} (name : String) (P : CProp) [DecidablePred P] (w : ) :

                                Build a weighted MAX constraint with a given weight.

                                Equations
                                Instances For
                                  def Phonology.Constraints.mkMaxCtxW {C : Type} (name : String) (D : CProp) [DecidablePred D] (Ctx : CProp) [DecidablePred Ctx] (w : ) :

                                  Build a weighted contextual MAX constraint.

                                  Equations
                                  Instances For
                                    def Phonology.Constraints.mkDepW {C : Type} (name : String) (P : CProp) [DecidablePred P] (w : ) :

                                    Build a weighted DEP constraint.

                                    Equations
                                    Instances For
                                      def Phonology.Constraints.mkIdentW {C : Type} (name : String) (P : CProp) [DecidablePred P] (w : ) :

                                      Build a weighted IDENT constraint.

                                      Equations
                                      Instances For
                                        def Phonology.Constraints.mkMarkW {C : Type} (name : String) (P : CProp) [DecidablePred P] (w : ) :

                                        Build a weighted binary markedness constraint.

                                        Equations
                                        Instances For
                                          def Phonology.Constraints.mkMarkGradW {C : Type} (name : String) (violations : C) (w : ) :

                                          Build a weighted gradient markedness constraint.

                                          Equations
                                          Instances For