The flat domain #
Flat α is Option α carrying the flat order: ⊥ (none, no information)
below everything, distinct values incomparable. An order-carrying alias in the
WithBot mold, but the underlying order is discrete, not lifted — committed
values are an antichain.
This is the free (Scott) domain on a set: the lift of the discrete order,
Flat = lift ∘ discrete, equivalently 1 + α as an object. Two facts make it
the canonical small domain rather than an ad-hoc gadget:
- it is bounded-complete but not a lattice — meets are total
(
SemilatticeInf, agreement or⊥) while joins are partial (PartialUnify:⊥is identity, equal commitments merge, distinct commitments have no upper bound). Bounded-completeness is the join being partial-yet-unique-when-defined; - it is ω-complete (
OmegaCompletePartialOrder) — chains are eventually constant, so they have suprema.Flatis the generator of domain theory and the order side of the lifting/partiality monad (Option), whose Kleisli arrowsα → Flat βare partial functions —PartialUnify.unifyamong them.
Linguistically it is one atomic feature slot: the order is [Shi86]'s and
[Car92]'s subsumption order (an information order — ⊥ = unmarked,
a wildcard for agreement), and Flat Bool is the knowledge order of Kleene
three-valued logic. Feature bundles are built from it by the Pi PartialUnify
instance; Compat is consistency.
The order skeleton (Option.FlatLE, Flat, the PartialOrder/OrderBot/
SemilatticeInf/OmegaCompletePartialOrder instances) is an [UPSTREAM]
candidate for Mathlib/Order/Flat.lean — root-level Flat as with WithBot,
coexisting with the existing namespaced Module.Flat and ConvexCone.Flat
(write _root_.Flat under open Module). The PartialUnify instance and
compat_iff stay here: PartialUnify is linglib's, not mathlib's.
Main declarations #
Option.FlatLE— the flat order as a relation onOption αFlat— the order-carrying alias, withPartialOrder,OrderBot,SemilatticeInf,OmegaCompletePartialOrder, andPartialUnifyinstancesFlat.coe_le_coe,Flat.not_coe_le_bot— the order, characterizedFlat.ωSup_mem_range— chains attain their supremum (the domain has height ≤ 2)Flat.ωScottContinuous_of_monotone— monotone maps out ofFlatare continuousFlat.liftEquiv— the free-domain universal property: functionsα → Dare exactly strict continuous mapsFlat α →𝒄 DFlat.compat_iff— slot compatibility (Compat), characterizedFlat.unify_distinct_eq_none— distinct atoms do not unify (the non-distributivity witness)
TODO #
The free-domain universal property is now liftEquiv (with its enabling lemma
ωScottContinuous_of_monotone). The remaining domain-theoretic program:
- Categorical freeness. Package
liftEquivas a free–forgetful adjunction betweenTypeand the pointedωCPOcategory —Flat ⊣ U(template: mathlib'slatToBddLatForgetAdjunction, the free bounded lattice viaWithBot). - Lifting monad. Give
Flat(=Option) its ω-CPO monad structure — the partiality/lifting monad — whose Kleisli arrowsα → Flat βare partial continuous functions;PartialUnify.unifyis one, which is why it composes throughOption.bind(unify_assoc). (mathlib has this forPart.) - Algebraicity / bounded-completeness. Every element of
Flat αis compact, making it an algebraic (finite-height) bounded-complete domain — the Scott-domain packaging of the partial joinPartialUnifyprovides. - Three-valued logic.
Flat Boolis the knowledge order of Kleene three-valued logic; the strong-Kleene connectives are exactly its continuous maps. Connects this substrate to the trivalence/presupposition layer.
Ergonomics, separately: add a coercion ↑ : α → Flat α (as WithBot.some) so
coe_le_coe/not_coe_le_bot need no explicit @LE.le, and move the order
relation out of the Option namespace (Option.FlatLE → Flat.LE).
The flat information order on an atomic feature slot: every
committed value persists upward, so none is below everything and
distinct atoms are incomparable.
Equations
- a.FlatLE b = ∀ (x : α), a = some x → b = some x
Instances For
Equations
- Option.FlatLE.instDecidableOfDecidableEq = isTrue ⋯
- Option.FlatLE.instDecidableOfDecidableEq = if h : x = y then isTrue ⋯ else isFalse ⋯
- Option.FlatLE.instDecidableOfDecidableEq = isFalse ⋯
Equations
Equations
- Flat.instBEq = { beq := Flat.instBEq._aux_1 }
Equations
- Flat.instRepr = { reprPrec := Flat.instRepr._aux_1 }
Equations
- Flat.instInhabited = { default := none }
Equations
- Flat.instPartialOrder = { le := fun (a b : Flat α) => Option.FlatLE a b, le_refl := ⋯, le_trans := ⋯, lt_iff_le_not_ge := ⋯, le_antisymm := ⋯ }
Equations
- Flat.instOrderBot = { bot := none, bot_le := ⋯ }
Equations
- Flat.instSemilatticeInfOfDecidableEq = { toPartialOrder := Flat.instPartialOrder, inf := Flat.inf, inf_le_left := ⋯, inf_le_right := ⋯, le_inf := ⋯ }
The flat domain is ω-complete #
A monotone chain in the flat order is eventually constant — ⊥ until it
(optionally) commits to a single value, then constant — so it has a
supremum. This is the flat domain, the canonical nontrivial example of an
OmegaCompletePartialOrder.
The flat domain is an OmegaCompletePartialOrder: chains are eventually
constant, so their suprema are the eventual value (or ⊥).
Equations
- Flat.instOmegaCompletePartialOrder = { toPartialOrder := Flat.instPartialOrder, ωSup := Flat.ωSupImpl✝, le_ωSup := ⋯, ωSup_le := ⋯ }
Chains in the flat domain attain their supremum — ωSup c is some c i:
the domain has height ≤ 2.
Every monotone map out of the flat domain is ωScottContinuous: chains
attain their suprema (ωSup_mem_range), so continuity is automatic. This is
the key fact behind the universal property liftEquiv.
The flat domain is free. Strict continuous maps out of Flat α into a
pointed domain D are exactly functions α → D — the universal property of
the free domain. The forward map precomposes with some; the inverse extends
by ⊥ ↦ ⊥, continuous by ωScottContinuous_of_monotone.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Unify two slots: none is identity, equal commitments merge,
distinct commitments clash.
Equations
- Flat.unify none b = some b
- Flat.unify (some x) none = some (some x)
- Flat.unify (some x) (some y) = if x = y then some (some x) else none
Instances For
Equations
- Flat.instPartialUnifyOfDecidableEq = { unify := Flat.unify, isLUB_of_unify_eq_some := ⋯, isSome_unify_of_bddAbove := ⋯ }
Slot compatibility, characterized: committed values must coincide; an uncommitted slot is a wildcard.
Non-distributivity #
The flat order is not distributive: three distinct atoms (with a top
adjoined) form the diamond M₃ — [Car92] takes subsumption orders
to be neither distributive nor modular in general. Flat carries only the
partial join (PartialUnify), so the distributive law cannot even be
stated on it directly; unify_distinct_eq_none is the witness — distinct
atoms have no upper bound, so the join the law would require is undefined.