Partially Ordered Constraints (POC) #
A POC grammar is a partial order on the constraint set ([Ant97];
[Kip93]) — represented as mathlib represents orders-as-data
(extend_partialOrder): a bare relation r : Fin n → Fin n → Prop with
[IsPartialOrder (Fin n) r], and [DecidableRel r] where counting needs it.
Each evaluation samples a total order consistent with the partial order — a
linear extension — and the OT optimum under that ranking is the output, so a
single grammar induces a distribution over outputs, uniform over consistent
linear extensions. The load-bearing identities are division-free cardinality
equations (sum_card_filter_picksAt here, the head-fiber counting in
Core.Optimization.PermSubsetCombinatorics); winProb and its rate
theorems are a ℚ veneer over them.
Main definitions #
- Grammars:
Eq(the discrete grammar — no rankings),Ranking.toRel σ(the total order a ranking induces), andstratified stratumOf inner(mutually-ranked strata refined by an inner order — [TS95]'s Stratified Domination Hierarchies — defined as mathlib'sProd.Lexpulled back alonga ↦ (stratumOf a, a), characterized bystratified_iff). IsConsistent r σ: σ is a linear extension ofr, defined as containmentr ≤ σ.toRelin the pointwise lattice of relations.consistentTotalOrders ris the (nonempty, by Szpilrajn)Finsetof them.winProb cands vp r i o: the probability that sampling underrselects outputofor inputi— a genuine distribution (winProb_nonneg,winProb_le_one,sum_winProb_eq_one).active vp i o o'/favoring vp i o o': the constraints distinguishing a candidate pair, and those preferringo.
Main statements #
consistentTotalOrders_eq_linearExtensions: POC's linear extensions are the ERC ones — the simple-ERC (Hasse-edge) encodingtoERCsidentifiesconsistentTotalOrderswithERC.linearExtensions([MR16]; [Pri02]).toGrammarroutes POC through theGrammarhub, andorderIdealAntimatroidrealizes the Birkhoff correspondence with order-ideal antimatroids ([Dil40]).winProbproduces intermediate frequencies (e.g. [CP11b]'s 8/24 vs 12/24 t/d-deletion rates) that no single ranking reproduces; categorically, partial orders add nothing over OT (RealizationProblem.isOTRealizable_iff_isPartialOrderRealizableinHarmonicGrammar.Expressivity).winProb_discrete_binary_rate/winProb_stratified_binary_rate: closed-form win rates for binary competitions. A ranking is decided by its earliest active constraint (picksAt_binary_iff_head_mem_favoring), sochosenwins at rate|favoring ∩ active| / |active|— restricted to the deciding stratum in the stratified case — with no enumeration of rankings.
Implementation notes #
Grammars are unbundled relations, never PartialOrder (Fin n) values: a
class-typed binder would become a local instance and capture the ≤/<
notation that must keep meaning Fin n's positional order. This is also
mathlib's own idiom for orders treated as data (Szpilrajn's
extend_partialOrder).
Grammars and their linear extensions #
Equality is a partial order — the discrete order, relating nothing beyond reflexivity. As a POC grammar it is [Ant97]'s "no ranking imposed" baseline: every permutation is a consistent linear extension.
A permutation σ is consistent with grammar r when r is contained
in the total order σ induces (Ranking.toRel) — σ is a linear extension
of r. Unfolds to ∀ a b, r a b → σ.symm a ≤ σ.symm b.
Equations
- OptimalityTheory.IsConsistent r σ = (r ≤ σ.toRel)
Instances For
Equations
- OptimalityTheory.instDecidableIsConsistentOfDecidableRelFin r σ = decidable_of_iff (∀ (a b : Fin n), r a b → (Equiv.symm σ) a ≤ (Equiv.symm σ) b) ⋯
The (decidable, finite) set of linear extensions of r.
Equations
- OptimalityTheory.consistentTotalOrders r = Finset.filter (OptimalityTheory.IsConsistent r) Finset.univ
Instances For
Consistency transports along constraint relabeling: g * σ extends r iff
σ extends the g-pullback of r.
The linear extensions of a grammar are closed under its symmetries: a
relabeling that preserves r acts on the consistent rankings.
For the discrete grammar, every permutation is a linear extension.
σ is consistent with the total order it induces — reflexivity of the relation lattice.
A ranking-induced order has its ranking as unique consistent linear
extension, by the rigidity of Ranking.toRel
(Ranking.toRel_le_toRel_iff).
Szpilrajn — every grammar has a consistent linear extension #
Every grammar has a consistent linear extension: Szpilrajn
(extend_partialOrder) extends r to a linear order, which is some
ranking's induced order (Ranking.exists_toRel_eq).
Stratified grammars #
Earlier strata dominate later ones wholesale, and within a stratum an inner order applies. With the discrete inner order this is the freely-ranked stratum grammar of [Ant97] eq. (50) — the Stratified Domination Hierarchy of [TS95] that constraint-demotion learning produces.
The stratified grammar induced by stratumOf and an inner order inner —
mathlib's lexicographic order (Prod.Lex) pulled back along
a ↦ (stratumOf a, a): strata compare strictly, ties defer to inner.
The plain characterization is stratified_iff; cross-stratum inner
edges are ignored.
Equations
- OptimalityTheory.stratified stratumOf inner a b = Prod.Lex (fun (x1 x2 : Fin s) => x1 < x2) inner (stratumOf a, a) (stratumOf b, b)
Instances For
Dominance in a stratified grammar holds iff a's stratum strictly precedes b's, or they share a stratum and the inner order relates them.
Equations
- OptimalityTheory.instDecidableRelFinStratified x✝¹ x✝ = decidable_of_iff (stratumOf x✝¹ < stratumOf x✝ ∨ stratumOf x✝¹ = stratumOf x✝ ∧ inner x✝¹ x✝) ⋯
Under a stratified grammar, an earlier-stratum constraint occupies a strictly earlier position in every consistent ranking.
Swapping two constraints of a stratum on which the inner order is trivial is a symmetry of the stratified grammar.
Consistent rankings of a stratified grammar are closed under swapping two constraints of a stratum on which the inner order is trivial.
Grounding in the ERC lex API #
A partial order is a set of dominance requirements — each related pair is a
simple ERC a ≫ b ([MR16]), and under this encoding the
consistent total orders are exactly ERC.linearExtensions ([Pri02]).
The simple-ERC encoding of a grammar, with one ERC a ≫ b
(simpleERC a b) for each related pair — diagonal pairs give trivial ERCs,
matching toRel's reflexivity. Transitively-implied pairs are entailed by the
covering pairs, so the encoding has the same linear extensions as the
Hasse-edge one.
Equations
- OptimalityTheory.toERCs r = Finset.image (fun (p : Fin n × Fin n) => OptimalityTheory.simpleERC p.1 p.2) {p : Fin n × Fin n | r p.1 p.2}
Instances For
A ranking satisfies toERCs r exactly when it is a linear extension of
r: per pair, satisfaction of simpleERC a b is σ.toRel a b.
The consistent total orders of a grammar are exactly the linear extensions of its simple-ERC encoding ([MR16]; [Pri02]).
The order-ideal antimatroid of a POC #
A grammar's Hasse-edge encoding is a consistent set of simple ERCs, so it has
a Birkhoff antimatroid whose feasible sets are exactly the order ideals of r
([Dil40]; [MR16]).
toERCs r is consistent: any linear extension of r satisfies it.
The order-ideal antimatroid of a grammar — the simple-ERC Birkhoff
antimatroid (Antimat.ofSimple) of its Hasse-edge encoding, whose feasible
sets are exactly the order ideals of r
(orderIdealAntimatroid_isFeasible_iff).
Equations
Instances For
Local feasibility against toERCs r is exactly the order-ideal
condition — whenever b ∈ S and a dominates b, also a ∈ S.
The feasible sets of orderIdealAntimatroid are the order ideals of r — the
Birkhoff correspondence, made concrete and decidable.
Bridge to the Grammar hub #
A partial order on constraints is the simple-ERC fragment of an OT grammar —
its consistent total orders are exactly the legs of
Grammar.ofERCs (toERCs r) ([MR16]).
The Grammar whose legs are r's consistent total orders.
Equations
Instances For
Probabilistic POC — winProb #
The constraints active on the candidate pair o, o' at input i —
those assigning the two candidates different violation counts
([Ant97]'s decisive constraints). Inactive constraints cannot
affect the competition.
Equations
- OptimalityTheory.active vp i o o' = {c : Fin n | vp i o c ≠ vp i o' c}
Instances For
The constraints favoring o over o' at input i — those assigning
o strictly fewer violations.
Equations
- OptimalityTheory.favoring vp i o o' = {c : Fin n | vp i o c < vp i o' c}
Instances For
σ picks output o for input i if o is the unique strict OT winner — every other in-set candidate is lex-strictly worse than o under σ.
Equations
- OptimalityTheory.PicksAt cands vp σ i o = (o ∈ cands i ∧ ∀ o' ∈ cands i, o' ≠ o → (toLex fun (k : Fin n) => vp i o (σ k)) < toLex fun (k : Fin n) => vp i o' (σ k))
Instances For
A ranking picks at most one output, since strict lex domination is asymmetric.
With pairwise-distinct violation profiles, every ranking picks some output — the candidate with the lex-minimal permuted profile wins strictly.
Equations
- OptimalityTheory.instDecidablePicksAt cands vp σ i o = id inferInstance
The probability that sampling under grammar r selects output o for
input i — the fraction of consistent extensions picking o. The denominator
is positive (consistentTotalOrders_card_pos), so this is a genuine
probability.
Equations
- OptimalityTheory.winProb cands vp r i o = ↑{σ ∈ OptimalityTheory.consistentTotalOrders r | OptimalityTheory.PicksAt cands vp σ i o}.card / ↑(OptimalityTheory.consistentTotalOrders r).card
Instances For
For the σ-induced total order, winProb collapses to a point mass —
probability 1 if σ picks o and 0 otherwise.
Under the discrete grammar, winProb is the fraction of all n!
rankings picking o.
With pairwise-distinct violation profiles the picks-fibers over the
candidate set partition the consistent extensions — the division-free core
of sum_winProb_eq_one.
Over a candidate set with pairwise-distinct violation profiles the win probabilities sum to 1, for any grammar — every consistent ranking picks exactly one winner.
Two distinct candidates with distinct violation profiles split the probability mass.
Bridge — binary PicksAt is decided by the σ-earliest active constraint #
For binary candidate sets cands i = {chosen, other}, PicksAt σ i chosen
reduces to lex domination of chosen's permuted profile, which is decided at
the first position where the profiles differ — i.e., chosen wins iff the
σ-earliest constraint of active vp i chosen other lies in
favoring vp i chosen other. Combined with the head-fiber counting of
Core.Optimization.PermSubsetCombinatorics, this yields closed-form rates
for binary POC competitions without enumerating rankings.
For binary candidate sets, PicksAt σ i chosen holds exactly when the
σ-earliest active constraint favors chosen.
Closed-form rate for binary candidates #
With binary candidates, the fraction of all n! rankings picking chosen
is |favoring ∩ active| / |active| — each ranking is decided by its
σ-earliest active constraint, and every active constraint is equally
likely to come first.
Deciding-stratum rate for stratified grammars #
A binary competition whose variants tie on every stratum before k is decided
within stratum k, with later strata — including any inner rankings among
them — provably irrelevant. This is [Ant97]'s tableau-count shortcut
stated against the full grammar rather than a per-stratum sub-grammar.
Under a stratified grammar, a binary competition whose variants tie on
every stratum before k — with k freely ranked internally (h_triv)
and containing an active constraint (h_dec) — is won by chosen at rate
|favoring ∩ Dₖ| / |Dₖ|, where Dₖ is the active set restricted to
stratum k. Later strata cannot affect the outcome.