Partial unification: computable pairwise least upper bounds #
PartialUnify α equips a partial order with a computable partial join:
unify a b returns the least upper bound of {a, b} when the pair is
bounded above, and none otherwise. This is the pairwise face of
bounded completeness — [Car92]'s setting for unification
domains (Definition 2.1: an inheritance hierarchy is a finite bounded
complete partial order), with the join taken as primitive because
"joins correspond to unifications" (p. 13). Carpenter notes the
equivalence this file exploits: "a finite BCPO is nothing more nor less
than a finite meet semilattice", presented through its joins.
The laws of unification — idempotence, commutativity,
associativity-with-failure, ⊥ as identity, guarded monotonicity —
are proved here once, from least-upper-bound uniqueness; carriers
(feature slots, bundles, attribute-value records) supply only unify
and the two axioms.
Adjoining a top element to make the join total is a derived presentation ([Car92] p. 16 attributes it to Aït-Kaci and Smolka), not the primitive; this file deliberately does not take it.
Main declarations #
PartialUnify— the classPartialUnify.unify_eq_some_iff_isLUB,PartialUnify.isSome_unify_iff_bddAbove— characterizationsPartialUnify.unify_comm,unify_assoc,unify_self,bot_unify,unify_mono— the unification laws- the Pi instance: pointwise unification over a
Fintypeindex
A computable partial join on a partial order: unify a b is some
of the least upper bound of {a, b} when the pair is bounded above,
and none otherwise — the pairwise face of [Car92]'s bounded
completeness, with the join as the primitive operation.
- unify : α → α → Option α
The partial join.
- isLUB_of_unify_eq_some {a b c : α} : unify a b = some c → IsLUB {a, b} c
A successful unification is a least upper bound.
- isSome_unify_of_bddAbove {a b : α} : BddAbove {a, b} → (unify a b).isSome = true
Unification succeeds on bounded-above pairs.
Instances
Glueing pairwise LUBs: if v is the LUB of {a, b}, then LUBs of
{v, c} are exactly LUBs of {a, b, c}.
Unification is associative, with failure propagating: both associations compute the least upper bound of all three elements.
Unification is monotone where defined: shrinking both inputs preserves success and shrinks the output.
Pointwise unification on Pi types #
Equations
- One or more equations did not get rendered due to their size.
Compatibility #
The consistency relation of unification: two elements are compatible when
they have a common upper bound — equivalently (compat_iff_isSome_unify),
when they unify. On feature carriers this is the agreement relation
([Car92]; [Shi86]'s "compatible").
⊥ is a wildcard: compatible with everything.
Compatibility is decided by unification.
Equations
- instDecidableCompatOfPartialUnify a b = decidable_of_iff ((PartialUnify.unify a b).isSome = true) ⋯