gaia.core.abstractions module

GAIA Framework Core Abstractions

This module provides the unified base abstractions for the entire GAIA framework, implementing the category-theoretic foundations From (MAHADEVAN,2024) and report.tex.

Key Design Principles: 1. Unified interfaces for all categorical structures 2. Composition over inheritance where possible 3. Type safety with generic protocols 4. Integration points for all subsystems

class gaia.core.abstractions.CategoryObject(id, name, dimension)[source]

Bases: object

Base class for all objects in GAIA categories.

id: UUID
name: str
dimension: int
__init__(id, name, dimension)
class gaia.core.abstractions.Morphism(*args, **kwargs)[source]

Bases: Protocol[X, Y]

Protocol for morphisms between category objects.

property domain: X

Source object of the morphism.

property codomain: Y

Target object of the morphism.

compose(other)[source]

Compose this morphism with another: other ∘ self.

__call__(x)[source]

Apply the morphism to an element.

classmethod __class_getitem__(params)

Parameterizes a generic class.

At least, parameterizing a generic class is the main thing this method does. For example, for some generic class Foo, this is called when we do Foo[int] - there, with cls=Foo and params=int.

However, note that this method is also called when defining generic classes in the first place with class Foo(Generic[T]): ….

__init__(*args, **kwargs)
class gaia.core.abstractions.Functor(*args, **kwargs)[source]

Bases: Protocol[X, Y]

Protocol for functors between categories.

map_object(obj)[source]

Map an object from source to target category.

map_morphism(morphism)[source]

Map a morphism from source to target category.

classmethod __class_getitem__(params)

Parameterizes a generic class.

At least, parameterizing a generic class is the main thing this method does. For example, for some generic class Foo, this is called when we do Foo[int] - there, with cls=Foo and params=int.

However, note that this method is also called when defining generic classes in the first place with class Foo(Generic[T]): ….

__init__(*args, **kwargs)
class gaia.core.abstractions.Endofunctor(*args, **kwargs)[source]

Bases: Functor[X, X], Protocol

Protocol for endofunctors F: C → C.

apply_to_object(obj)[source]

Apply endofunctor to an object.

iterate(obj, steps)[source]

Iterate the endofunctor multiple times.

classmethod __class_getitem__(params)

Parameterizes a generic class.

At least, parameterizing a generic class is the main thing this method does. For example, for some generic class Foo, this is called when we do Foo[int] - there, with cls=Foo and params=int.

However, note that this method is also called when defining generic classes in the first place with class Foo(Generic[T]): ….

__init__(*args, **kwargs)
map_morphism(morphism)

Map a morphism from source to target category.

map_object(obj)

Map an object from source to target category.

class gaia.core.abstractions.StructureMap(*args, **kwargs)[source]

Bases: Protocol[X]

Protocol for coalgebra structure maps γ: X → F(X).

__call__(state)[source]

Apply structure map to evolve state.

classmethod __class_getitem__(params)

Parameterizes a generic class.

At least, parameterizing a generic class is the main thing this method does. For example, for some generic class Foo, this is called when we do Foo[int] - there, with cls=Foo and params=int.

However, note that this method is also called when defining generic classes in the first place with class Foo(Generic[T]): ….

__init__(*args, **kwargs)
class gaia.core.abstractions.Coalgebra(carrier, structure_map)[source]

Bases: Generic[X], ABC

Abstract base class for F-coalgebras (X, γ).

__init__(carrier, structure_map)[source]
evolve(state)[source]

Evolve state using structure map: γ(state).

abstractmethod is_bisimilar(other, relation)[source]

Check if two coalgebras are bisimilar.

classmethod __class_getitem__(params)

Parameterizes a generic class.

At least, parameterizing a generic class is the main thing this method does. For example, for some generic class Foo, this is called when we do Foo[int] - there, with cls=Foo and params=int.

However, note that this method is also called when defining generic classes in the first place with class Foo(Generic[T]): ….

class gaia.core.abstractions.FuzzyMembership(*args, **kwargs)[source]

Bases: Protocol

Protocol for fuzzy membership functions η: X → [0,1].

__call__(element)[source]

Compute membership degree in [0,1].

support()[source]

Return support set {x | η(x) > 0}.

classmethod __class_getitem__(params)

Parameterizes a generic class.

At least, parameterizing a generic class is the main thing this method does. For example, for some generic class Foo, this is called when we do Foo[int] - there, with cls=Foo and params=int.

However, note that this method is also called when defining generic classes in the first place with class Foo(Generic[T]): ….

__init__(*args, **kwargs)
class gaia.core.abstractions.SimplicialStructure(*args, **kwargs)[source]

Bases: Protocol

Protocol for simplicial structures with face and degeneracy maps.

face_map(i)[source]

Apply i-th face map δᵢ.

degeneracy_map(i)[source]

Apply i-th degeneracy map σᵢ.

property dimension: int

Dimension of the simplicial structure.

classmethod __class_getitem__(params)

Parameterizes a generic class.

At least, parameterizing a generic class is the main thing this method does. For example, for some generic class Foo, this is called when we do Foo[int] - there, with cls=Foo and params=int.

However, note that this method is also called when defining generic classes in the first place with class Foo(Generic[T]): ….

__init__(*args, **kwargs)
class gaia.core.abstractions.HornFiller(*args, **kwargs)[source]

Bases: Protocol

Protocol for horn filling algorithms.

can_fill(horn_type, dimension, missing_face)[source]

Check if this filler can handle the given horn.

fill_horn(horn_data)[source]

Fill the horn if possible.

classmethod __class_getitem__(params)

Parameterizes a generic class.

At least, parameterizing a generic class is the main thing this method does. For example, for some generic class Foo, this is called when we do Foo[int] - there, with cls=Foo and params=int.

However, note that this method is also called when defining generic classes in the first place with class Foo(Generic[T]): ….

__init__(*args, **kwargs)
class gaia.core.abstractions.MessagePasser(*args, **kwargs)[source]

Bases: Protocol

Protocol for hierarchical message passing.

send_up(message, level)[source]

Send message up the hierarchy via degeneracy maps.

send_down(message, level)[source]

Send message down the hierarchy via face maps.

process_message(message, source_level, target_level)[source]

Process message between hierarchy levels.

classmethod __class_getitem__(params)

Parameterizes a generic class.

At least, parameterizing a generic class is the main thing this method does. For example, for some generic class Foo, this is called when we do Foo[int] - there, with cls=Foo and params=int.

However, note that this method is also called when defining generic classes in the first place with class Foo(Generic[T]): ….

__init__(*args, **kwargs)
class gaia.core.abstractions.TrainingState(epoch, step, loss, parameters, gradients, metadata)[source]

Bases: object

Unified training state for GAIA framework.

epoch: int
step: int
loss: float
parameters: Tensor' id='4349657872'>]
gradients: Tensor' id='4349657872'>]
metadata: Dict[str, Any]
__init__(epoch, step, loss, parameters, gradients, metadata)
class gaia.core.abstractions.GAIAComponent(name, config=None)[source]

Bases: ABC

Abstract base class for all GAIA framework components.

__init__(name, config=None)[source]
abstractmethod initialize()[source]

Initialize the component.

abstractmethod update(state)[source]

Update component with new training state.

abstractmethod validate()[source]

Validate component state and configuration.

class gaia.core.abstractions.IntegratedTrainer(components)[source]

Bases: ABC

Abstract base class for integrated GAIA trainers.

__init__(components)[source]
abstractmethod train_step()[source]

Execute one training step across all components.

abstractmethod validate_step()[source]

Execute validation across all components.

add_component(component)[source]

Add a component to the trainer.

get_component(name)[source]

Get a component by name.

gaia.core.abstractions.compose_morphisms(*morphisms)[source]

Compose multiple morphisms: f₁ ∘ f₂ ∘ … ∘ fₙ.

gaia.core.abstractions.create_identity_morphism(obj)[source]

Create identity morphism for an object.

gaia.core.abstractions.verify_functor_laws(functor, test_objects, test_morphisms)[source]

Verify functor preserves identity and composition.

class gaia.core.abstractions.ComponentRegistry[source]

Bases: object

Registry for managing GAIA components.

__init__()[source]
register(component, dependencies=None)[source]

Register a component with optional dependencies.

get(name)[source]

Get a component by name.

initialize_all()[source]

Initialize all components in dependency order.