Feature bundles #
The representation-polymorphic interface for feature bundles, and the
canonical extensional representation Features.Bundle.
A feature bundle assigns values to features. Theories disagree about
what a bundle is — a list of valued features, a finite set, a partial
assignment over a feature space, an attribute-value structure, a
hierarchical tree whose root label is the flat bundle. They agree about
what a bundle says: which features it specifies, with which values.
BundleLike captures that shared observation language — a single
valuation val : B → (t : F) → S t — so that specification,
subsumption, and the information order are stated once and inherited by
every representation.
Extensionality is deliberately not part of BundleLike: structured
representations (assembly trees, feature-geometric hierarchies) can
present the same valuation in distinct ways, and that multiplicity can
itself carry theoretical content. Representations whose valuation is
injective opt into LawfulBundleLike and get extensionality and the
subsumption partial order.
All three parameters are fully general. The feature space F is data,
not a built-in inventory, so per-language and per-theory feature sets
are choices of F. The slot family S : F → Type* is the per-feature
information space — it carries its own order, so each slot may be (a)
Flat (V t) for a single atom from an enum V t (the determinate
case: privative if V t := Unit, bivalent if V t := Bool,
multivalent for an enum, mode-tagged products for valued/unvalued
distinctions, ℚ for gradient theories); or (b) (Finset α)ᵒᵈ for
indeterminate values in the sense of [DK00]; or (c)
some richer order for layered or hierarchical features. The lattice
theory is proved once at the Pi level and inherited by every choice of
S.
Main declarations #
BundleLike— the valuation interfaceLawfulBundleLike— extensional representations; givesBundleLike.extandBundleLike.partialOrderBundleLike.Specifies,BundleLike.Subsumes— the derived API;Subsumesis the subsumption order of the unification-grammar tradition ([Shi86])Features.Bundle F V— the canonical extensional carrier, a partial assignment(t : F) → Option (V t), carrying the subsumptionPartialOrderwith⊥the everywhere-underspecified bundleBundleLike.subsumptionPreorder— any representation pulls the subsumption order back alongval, as aCore.Order.PullbackPreorder
Implementation notes #
Features.Bundle is an abbrev over the Pi type of Flat slots
(Core/Order/Flat.lean): the reducibility barrier sits at Flat, so
the subsumption order does not leak onto bare Option-valued Pi types,
while mathlib's Pi instances supply the whole order stack — the
subsumption PartialOrder, OrderBot (⊥ = everywhere
underspecified), SemilatticeInf (generalization/anti-unification),
and the partial join PartialUnify (unification). This is the bounded
complete partial order of the unification tradition ([Car92]
Definition 2.1; "a finite BCPO is nothing more nor less than a finite
meet semilattice", presented through its joins). Features.Bundle is
unrelated to mathlib's fiber-bundle Bundle namespace; qualify when
both are in scope.
Instances live with their carriers, not here: this file imports only
Core and mathlib, and e.g. Morphology.UD.MorphFeatures instantiates
BundleLike in its own file.
The phonological carrier uses Bundle directly: Phonology.Segment's spec
field is Features.Bundle Feature (fun _ => Bool) (in unfolded Feature → Option Bool form), with the shared merge/set/delete algebra below.
Todo #
- Instantiate
BundleLikeat the MinimalistFeatureBundle(lawful only after the planned list-to-assignment retype). - Per-slot generality:
Bundlefixes the flat slot order. UD-practice pressure (multivalued features asFinset-superset slots, layered features as a nested index) is accommodated by working with(t : F) → S tfor other slot ordersS; thePartialUnifyPi instance is already stated at that generality. - A hierarchical assembly-tree carrier with the flattening valuation —
BundleLikebut notLawfulBundleLike.
BundleLike B F S: B presents feature bundles over the feature
space F, with slot t taking values in the order space S t. The
single primitive is the valuation: a function reading off the slot
value at each feature.
The slot type S t carries its own order. The canonical flat-atomic
slot is Flat (V t) for an atom enum V t; richer slot orders
(Finset α for indeterminacy in the sense of [DK00],
nested attribute spaces for UD layered features) are obtained by
choosing different S.
- val : B → (t : F) → S t
The value the bundle assigns to feature
t.
Instances
An extensional bundle representation: bundles with the same valuation are equal. Structured representations whose internal organization outruns their valuation are deliberately not lawful.
- val_injective : Function.Injective BundleLike.val
Instances
Extensionality for lawful representations.
b specifies feature t (assigns it more than the slot's bottom
information). For flat slots this coincides with "the slot is some";
for richer slots (set-valued indeterminacy) it means "the slot has not
been left at Finset.univ" (in the order dual where superset = less
determinate). Only Bot is required; the order is not.
Equations
- BundleLike.Specifies b t = (BundleLike.val b t ≠ ⊥)
Instances For
Subsumption: pointwise ≤ on slots — b₂ is at least as specified as
b₁ ([Shi86] §3.2.2; [Car92] Definition 2.1). For flat
slots this is Option.FlatLE; for set-valued slots it is the
indeterminacy order ([DK00]: superset = less
determinate).
Equations
- BundleLike.Subsumes b₁ b₂ = ∀ (t : F), BundleLike.val b₁ t ≤ BundleLike.val b₂ t
Instances For
On a lawful representation with partial slot orders, subsumption is antisymmetric.
The subsumption partial order on a lawful representation. Not an instance: a representation may carry its own canonical order.
Equations
- BundleLike.partialOrder = { le := BundleLike.Subsumes, le_refl := ⋯, le_trans := ⋯, lt_iff_le_not_ge := ⋯, le_antisymm := ⋯ }
Instances For
The canonical extensional feature bundle: a partial assignment of
values to features, as a Pi type of Flat slots. Underspecification is
none; at most one value per feature holds by construction. The order
stack — subsumption PartialOrder, OrderBot, SemilatticeInf,
PartialUnify — is inherited from the slots through mathlib's Pi
instances (the reducibility barrier lives at Flat, see the module
docstring).
Equations
- Features.Bundle F V = ((t : F) → Flat (V t))
Instances For
Equations
- Features.Bundle.instBundleLikeFlat = { val := fun (b : Features.Bundle F V) => b }
The Pi subsumption order agrees with the interface-level
BundleLike.Subsumes.
Equations
- b₁.instDecidableLeOfFintypeOfDecidableEq b₂ = Fintype.decidableForallFintype
The bundle specifying exactly one feature.
Equations
- Features.Bundle.single t v = Function.update ⊥ t (some v)
Instances For
Mutation algebra #
Function.update/orElse-based operations for building and combining
bundles, dual to the order/lattice stack above. General over any
Bundle F V; the phonological Segment and tonal TRN specialize them
at V := fun _ => Bool.
Override: set feature t to some v, regardless of current value.
Equations
- Features.Bundle.set t v b = Function.update b t (some v)
Instances For
Deletion: return feature t to underspecified (none).
Equations
- Features.Bundle.delete t b = Function.update b t none
Instances For
Single-feature assimilation: tgt adopts src's value at t,
leaving every other feature untouched.
Equations
- Features.Bundle.assimilate t src tgt = Function.update tgt t (src t)
Instances For
Any bundle representation with a finite signature carries the
subsumption order pulled back along its valuation into the Pi
(t : F) → S t, packaged as a Core.Order.PullbackPreorder.
Coarsenings between representations factor through
Core.Order.PullbackPreorder.coarsen_via_monotone. A def, not an
instance, matching PullbackPreorder's own convention.
Equations
- BundleLike.subsumptionPreorder = Core.Order.PullbackPreorder.ofProj (fun (b : B) => BundleLike.val b) fun (a a' : B) => Fintype.decidableForallFintype