Type System
Definition
The UOR type system provides a structured way to classify objects in the ring. The base class is TypeDefinition.
Type Hierarchy
| Class | Description |
|---|---|
| TypeDefinition | Base type |
| PrimitiveType | Atomic type (e.g., u8, u16) |
| ProductType | Cartesian product of types |
| SumType | Discriminated union of types |
| ConstrainedType | Type with additional constraints |
Properties
| Property | Domain | Range | Description |
|---|---|---|---|
| bitWidth | PrimitiveType | xsd:nonNegativeInteger | Bit width |
| component | ProductType | TypeDefinition | Component types |
| baseType | SumType/ConstrainedType | TypeDefinition | Base type |
| contentAddress | TypeDefinition | u:Element | Content address |
Example: Primitive Types
<https://uor.foundation/instance/type-u8>
a type:PrimitiveType ;
type:bitWidth "8"^^xsd:nonNegativeInteger .
<https://uor.foundation/instance/type-u64>
a type:PrimitiveType ;
type:bitWidth "64"^^xsd:nonNegativeInteger .
Integration with State
Types are used in Binding to record the type of bound values:
<https://uor.foundation/instance/binding-x>
a state:Binding ;
state:boundType <https://uor.foundation/instance/type-u8> .
Integration with Partition
Types serve as the source for partition computations via sourceType.
Constrained Types
A ConstrainedType wraps a base type with additional constraints that restrict the set of valid values. Constraints are combined using CompositeConstraint:
<https://uor.foundation/instance/constrained-odd-shallow>
a type:ConstrainedType ;
type:baseType <https://uor.foundation/instance/type-u8> ;
type:constraint "residue(2,1) AND depth(1,2)" .
This constrained type accepts only values in Z/256Z that are odd (residue 1 mod 2) and have valuation depth between 1 and 2. Each constraint pins specific sites of the Z/2Z fibration:
- ResidueConstraint (mod 2, residue 1) pins site 0.
- DepthConstraint (depth 1–2) pins sites 0 and 1.
Types and Free Rank
Each constraint pins sites, and the type's total free rank tracks how many sites remain free. A fully resolved type has zero free sites — every site is pinned by at least one constraint. See Free Rank for the accounting and Constraint Algebra for how constraints compose.