topos.core.omega¶
Omega — The Subobject Classifier of the Topos¶
This module is Ω, the subobject classifier of the topos
E = Set^(C × H^op). Equivalently, it is the value Heyting algebra
H = H(G_qual), the free Heyting algebra on the finite set of
quality generators
G_qual = { SIMPLE, COMPOSABLE, SECURE }
In a topos the subobject classifier object and the internal-logic Heyting
algebra coincide — Ω carries both roles. The characteristic morphism
χ_S : P → Ω that maps a program into Ω lives in
topos.evaluation.characteristic_morphism; this file holds only the
algebra itself (objects, ordering, lattice operations).
The carrier of Ω is the 8-element poset of all subsets of G_qual:
IDEAL (top, ⊤ = SIMPLE ∧ COMPOSABLE ∧ SECURE)
/ | \
/ | \
/ | \
SIMPLE_COMPOSABLE SIMPLE_SECURE COMPOSABLE_SECURE
| \ / \ / |
| \/ \/ |
| /\ /\ |
| / \ / \ |
SIMPLE COMPOSABLE SECURE
\ | /
\ | /
\ | /
SLOP (bottom, ⊥)
The three generators are pairwise incomparable: leq(SIMPLE, COMPOSABLE)
is False in both directions. Meets are intersections of the satisfied
generator sets; meet(SIMPLE, COMPOSABLE) == SIMPLE_COMPOSABLE adds a
generator; meet(SIMPLE_COMPOSABLE, SECURE) == IDEAL.
The ordering is the partial order of satisfied-generator inclusion: a
verdict a is ≤ b iff the set of generators a satisfies is a
superset of the set b satisfies. Top (IDEAL) satisfies every
generator; bottom (SLOP) satisfies none. This is the order required by
the math spec (section 1, “reverse metric/constraint inclusion”): adding a
satisfied constraint moves the verdict down toward IDEAL.
The implementation uses an explicit cover relation rather than an integer
ordering — singletons (SIMPLE, COMPOSABLE, SECURE) are pairwise
incomparable, so the Hasse diagram is a 3-cube, not a chain. meet /
join / implies / negation are computed generically from the
cover, so this engine works for arbitrary finite Heyting algebras.
Categorical / Pythonic names:
Math Python
-------------- -----------------------------------------
Ω Omega (this class)
elements of Ω EvaluationValue (the enum)
⊤ EvaluationValue.IDEAL / Omega.TOP
⊥ EvaluationValue.SLOP / Omega.BOTTOM
χ_S : P → Ω CharacteristicMorphism (sibling module)
The top is IDEAL — the joint-satisfaction of all generators. The
bottom is SLOP, the unconstrained universe.
- class topos.core.omega.EvaluationValue(*values)[source]
Bases:
IntEnumThe eight elements of the free Heyting algebra H(G_qual) on three quality generators (SIMPLE, COMPOSABLE, SECURE).
Each value corresponds to the subset of generators a program satisfies. Ordering is by superset of satisfied generators:
a ≤ biff every generator satisfied bybis also satisfied bya. ThusIDEAL = ⊤(everything satisfied) andSLOP = ⊥(nothing satisfied).Encoding (integer value = bitmask SIMPLE|COMPOSABLE|SECURE):
- bit 0 = SIMPLE satisfied - bit 1 = COMPOSABLE satisfied - bit 2 = SECURE satisfied
Values:
SLOP:⊥ - no generator satisfied. The unconstrained universe; total structural chaos.
SIMPLE:Only the SIMPLE generator is satisfied.
COMPOSABLE:Only the COMPOSABLE generator is satisfied.
SIMPLE_COMPOSABLE:Meet of SIMPLE and COMPOSABLE.
SECURE:Only the SECURE generator is satisfied.
SIMPLE_SECURE:Meet of SIMPLE and SECURE.
COMPOSABLE_SECURE:Meet of COMPOSABLE and SECURE.
IDEAL:⊤ - all three generators satisfied.
- SLOP = 0
- SIMPLE = 1
- COMPOSABLE = 2
- SIMPLE_COMPOSABLE = 3
- SECURE = 4
- SIMPLE_SECURE = 5
- COMPOSABLE_SECURE = 6
- IDEAL = 7
- property symbol
Unicode symbol representation.
- property description
Human-readable description of this evaluation value.
- topos.core.omega.verdict_from_generators(*, simple, composable, secure)[source]
Map a satisfied-generator triple to its free-algebra verdict.
This is the concrete encoding of the truth table from
README.md: every subset ofG_qualis a unique verdict.- Parameters:
simple – True iff the SIMPLE generator is satisfied.
composable – True iff the COMPOSABLE generator is satisfied.
secure – True iff the SECURE generator is satisfied.
- class topos.core.omega.Omega(cover=<factory>)[source]
Bases:
objectΩ — the subobject classifier object of the program topos.
In the topos
E = Set^(C × H^op)the subobject classifier coincides with the value Heyting algebraH(G_qual). This class carries both roles: it is the truth-value object whose elements (EvaluationValue) are the verdicts a program can receive, and the Heyting algebra whose operations (meet, join, implies, negation) give the internal logic of the topos.Encodes the 3-cube Hasse diagram via an explicit cover relation. All lattice operations are computed generically from the cover; no change is needed if the algebra is later extended with additional generators or modified by quotient relations.
- Class Attributes:
BOTTOM: The least element (⊥ = SLOP) TOP: The greatest element (⊤ = IDEAL)
- BOTTOM = 0
- TOP = 7
- DEFAULT_COVER = {EvaluationValue.SLOP: [EvaluationValue.SIMPLE, EvaluationValue.COMPOSABLE, EvaluationValue.SECURE], EvaluationValue.SIMPLE: [EvaluationValue.SIMPLE_COMPOSABLE, EvaluationValue.SIMPLE_SECURE], EvaluationValue.COMPOSABLE: [EvaluationValue.SIMPLE_COMPOSABLE, EvaluationValue.COMPOSABLE_SECURE], EvaluationValue.SIMPLE_COMPOSABLE: [EvaluationValue.IDEAL], EvaluationValue.SECURE: [EvaluationValue.SIMPLE_SECURE, EvaluationValue.COMPOSABLE_SECURE], EvaluationValue.SIMPLE_SECURE: [EvaluationValue.IDEAL], EvaluationValue.COMPOSABLE_SECURE: [EvaluationValue.IDEAL], EvaluationValue.IDEAL: []}
- cover
- classmethod from_cover_relation(cover)[source]
Construct a lattice from direct cover relations.
- Parameters:
cover – Mapping from each value to its immediate successors.
- leq(a, b)[source]
Lattice ordering: a ≤ b.
- meet(a, b)[source]
The ‘And’ operation (Greatest Lower Bound).
For the free Heyting algebra on quality generators, this is the intersection of satisfied-generator sets.
- join(a, b)[source]
The ‘Or’ operation (Least Upper Bound).
For the free Heyting algebra on quality generators, this is the union of satisfied-generator sets (i.e. the most-specific verdict that both a and b dominate).
- implies(a, b)[source]
Intuitionistic implication (→).
a → b is the largest x such that a ∧ x ≤ b.
- negation(a)[source]
Intuitionistic negation (¬), i.e. a → ⊥.
- aggregate(metric_evaluations)[source]
Aggregate evaluation values via meet.
Multi-file rollup is exactly this meet: a generator is satisfied across a codebase iff it is satisfied for every file.
- combine(*values)[source]
Combine multiple evaluation values using meet (∧).
- equivalent(a, b)[source]
Check if two evaluation values are equivalent.
In a Heyting Algebra, a ↔ b iff (a → b) ∧ (b → a) = ⊤