Type System

Definition

The UOR type system provides a structured way to classify objects in the ring. The base class is TypeDefinition.

Type Hierarchy

ClassDescription
TypeDefinitionBase type
PrimitiveTypeAtomic type (e.g., u8, u16)
ProductTypeCartesian product of types
SumTypeDiscriminated union of types
ConstrainedTypeType with additional constraints

Properties

PropertyDomainRangeDescription
bitWidthPrimitiveTypexsd:nonNegativeIntegerBit width
componentProductTypeTypeDefinitionComponent types
baseTypeSumType/ConstrainedTypeTypeDefinitionBase type
contentAddressTypeDefinitionu:ElementContent 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:

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.