gaia.core package
GAIA Core Module - Clean Architecture
This module provides the core categorical structures for the GAIA framework
- class gaia.core.SimplicialObject(level, name, payload=None)[source]
Bases:
object
Base class for all simplicial objects in the GAIA framework.
- __init__(level, name, payload=None)
- class gaia.core.Simplex0(dim, name, registry, payload=None, same_basis=False, basis_id=None)[source]
Bases:
SimplicialObject
0-simplex representing an object in the Param category.
Following Mahadevan (2024), objects are equivalence classes of parameter spaces <d> modulo differentiable isomorphism.
- dim
- basis_id
- class gaia.core.Simplex1(morphism, domain, codomain, name, payload=None)[source]
Bases:
SimplexN
1-simplex representing a morphism in the Param category.
Following Mahadevan (2024), morphisms are equivalence classes of differentiable maps modulo parameter re-parameterization.
- morphism
- __call__(x)[source]
Apply the morphism to input tensor x.
If this is a composition morphism (with payload function), always use the payload to ensure dynamic composition is maintained.
- __eq__(other)
Equality based on level, components, and name.
- __hash__()
Hash based on level, components, and name.
- components
- degeneracy(j)
Compute the j-th degeneracy by duplicating the j-th component.
Pure categorical operation with no identity checking.
- face(i)
Compute the i-th face by removing the i-th component.
This is a pure categorical operation - no identity verification. The functor is responsible for maintaining simplicial identities.
- class gaia.core.Simplex2(f, g, name, payload=None)[source]
Bases:
SimplexN
2-simplex representing a commutative triangle in the Param category.
Following Mahadevan (2024), this implements the inner horn Λ²₁ with endofunctorial solver where h = g ∘ f is computed dynamically to maintain coherence during training.
- components
- __eq__(other)
Equality based on level, components, and name.
- __hash__()
Hash based on level, components, and name.
- degeneracy(j)
Compute the j-th degeneracy by duplicating the j-th component.
Pure categorical operation with no identity checking.
- face(i)
Compute the i-th face by removing the i-th component.
This is a pure categorical operation - no identity verification. The functor is responsible for maintaining simplicial identities.
- is_inner_horn(missing_face)[source]
Check if this is an inner horn with the specified missing face.
- class gaia.core.SimplexN(level, name, components, payload=None)[source]
Bases:
SimplicialObject
n-simplex for n ≥ 1, representing higher-dimensional simplicial structure.
This is a pure categorical implementation with no local identity checking. All simplicial identities are verified globally at the functor level.
- components
- degeneracy(j)[source]
Compute the j-th degeneracy by duplicating the j-th component.
Pure categorical operation with no identity checking.
- class gaia.core.SimplicialFunctor(name, basis_registry)[source]
Bases:
object
GAIA Simplicial Functor: Δᵒᵖ → Neural-network parameters.
Following Mahadevan (2024), this implements a complete simplicial functor where the functor defines all structural relationships explicitly. The functor is the sole arbiter of simplicial structure.
Key Principles: 1. Pure contravariant functor - defines structure, never discovers it 2. Global simplicial identity verification ONLY 3. Direct horn detection via structure queries 4. Explicit structure definition methods 5. Complete categorical coherence validation
- add(simplex)[source]
Registers a simplex as an object in the target category.
CRITICAL: This method does NOT infer, discover, or create any structural maps. It ONLY registers the simplex as an object. The functor defines structure through explicit define_face/define_degeneracy calls.
NO LOCAL CHECKS - all validation is global via validate() method.
- create_coalgebra_structure_map(simplex_id)[source]
Create structure map γ: X → F(X) from endofunctor update history.
This constructs the coalgebraic structure map from recorded updates.
- create_morphism(network, source, target, name)[source]
Factory method to create a 1-simplex (morphism) with automatic registration.
This method creates the morphism AND automatically defines its face maps according to the categorical structure.
- create_object(dim, name, same_basis=True)[source]
Factory method to create a 0-simplex (object) with automatic registration.
This is the ONLY correct way to create objects in the functor. The functor maintains complete control over structure.
- create_triangle(f, g, name)[source]
Factory method to create a 2-simplex (triangle) with automatic registration.
This method creates the triangle AND automatically defines all its face maps according to the categorical structure.
- define_degeneracy(source_id, index, degen_id)[source]
Explicitly defines the j-th degeneracy map, s_j: [n] → [n+1]. This method is the functor’s action on the co-degeneracy maps in Δᵒᵖ.
This is how the functor DEFINES degeneracy structure.
- define_face(source_id, index, face_id)[source]
Explicitly defines the i-th face map, d_i: [n] → [n-1]. This method is the functor’s action on the coface maps in Δᵒᵖ.
This is how the functor DEFINES structure - the sole mechanism for creating face relationships in the categorical mapping.
- degeneracy(index, simplex_id)[source]
Get the degeneracy of a simplex at the given index. Queries the functor’s defined structure directly.
- diagnose_partial_structure()[source]
SEPARATE diagnostic method for analyzing incomplete structures.
This method is explicitly for debugging and development, providing insights into the current state of a potentially incomplete functor. It does NOT attempt to validate identities on incomplete structures.
- face(index, simplex_id)[source]
Get the face of a simplex at the given index. Queries the functor’s defined structure directly.
- find_horns(level, horn_type='both')[source]
Locates all n-simplices where a face map is not defined.
This method now queries the functor’s structure directly
via self.maps rather than relying on non-existent pending caches. A horn is identified structurally as a missing map in the functor.
- get_endofunctor_trajectory(simplex_id)[source]
Get trajectory of endofunctor updates for a simplex.
This provides the coalgebraic evolution history γ^n(x₀).
- has_lift(f_id, p_id)[source]
Queries the functor to solve a lifting problem.
This method poses the question: Given morphisms f: A -> B and p: E -> B, which morphisms h: A -> E exist such that p ∘ h = f?
- register_endofunctor_update(simplex_id, old_state, new_state, endofunctor_name='F')[source]
Register endofunctor update for coalgebraic dynamics.
This method implements the structure map γ: X → F(X) for F-coalgebras by recording state transitions under endofunctor application.
- verify_simplicial_identities()[source]
verification of simplicial identities on a functor.
This method validates that the functor preserves the simplicial identities as required by category theory. It assumes a complete structural definition and performs a clean, elegant validation of the three identity classes:
Face-face identities: d_i ∘ d_j = d_{j-1} ∘ d_i for i < j
Degeneracy-degeneracy identities: s_i ∘ s_j = s_{j+1} ∘ s_i for i ≤ j
Mixed identities: Various d_i ∘ s_j relations
- class gaia.core.MapType(value)[source]
Bases:
Enum
- FACE = 'face'
- DEGENERACY = 'degeneracy'
- classmethod __contains__(member)
Return True if member is a member of this enum raises TypeError if member is not an enum member
note: in 3.12 TypeError will no longer be raised, and True will also be returned if member is the value of a member in this enum
- classmethod __getitem__(name)
Return the member matching name.
- classmethod __iter__()
Return members in definition order.
- classmethod __len__()
Return the number of members (no aliases)
- exception gaia.core.HornError[source]
Bases:
SimplicialError
Error raised when a horn is encountered.
- __init__(*args, **kwargs)
- add_note()
Exception.add_note(note) – add a note to the exception
- args
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- class gaia.core.IntegratedFuzzySet(elements, membership_fn, name='fuzzy_set')[source]
Bases:
GAIAComponent
Integrated fuzzy set implementing sheaf structure on [0,1].
- class gaia.core.IntegratedSimplex(dimension, name, components=None, membership=1.0, payload=None)[source]
Bases:
SimplicialStructure
Integrated simplex with fuzzy membership and categorical 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]): ….
- class gaia.core.IntegratedFuzzySimplicialSet(name, max_dimension=3)[source]
Bases:
GAIAComponent
Integrated fuzzy simplicial set combining fuzzy and simplicial structures.
- class gaia.core.IntegratedCoalgebra(initial_state, endofunctor, name='coalgebra')[source]
Bases:
Coalgebra
[<MockTorch name=’mock.Tensor’ id=’4349657872’>],GAIAComponent
Integrated coalgebra for GAIA training dynamics.
- 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]): ….
- evolve(state)
Evolve state using structure map: γ(state).
- class gaia.core.TConorm(value)[source]
Bases:
Enum
T-conorms for fuzzy set operations.
- MAXIMUM = 'maximum'
- PROBABILISTIC = 'probabilistic'
- LUKASIEWICZ = 'lukasiewicz'
- classmethod __contains__(member)
Return True if member is a member of this enum raises TypeError if member is not an enum member
note: in 3.12 TypeError will no longer be raised, and True will also be returned if member is the value of a member in this enum
- classmethod __getitem__(name)
Return the member matching name.
- classmethod __iter__()
Return members in definition order.
- classmethod __len__()
Return the number of members (no aliases)
- class gaia.core.FuzzyElement(element, membership)[source]
Bases:
object
Element with fuzzy membership degree.
- __init__(element, membership)
- gaia.core.create_fuzzy_simplex(dimension, name, membership=1.0)[source]
Create a fuzzy simplex with given properties.
- gaia.core.create_fuzzy_simplicial_set_from_data(data, k=5, name='data_fss')[source]
Create fuzzy simplicial set from point cloud data using k-NN.
- gaia.core.merge_fuzzy_simplicial_sets(*fss_list, t_conorm=TConorm.MAXIMUM)[source]
Merge multiple fuzzy simplicial sets.
- class gaia.core.KanComplexVerifier(simplicial_functor)[source]
Bases:
object
Complete Kan complex verification system.
This orchestrates all Kan condition verifications and provides a comprehensive assessment of the simplicial structure.
- class gaia.core.KanConditionType(value)[source]
Bases:
Enum
Types of Kan conditions to verify.
- INNER_HORN_FILLING = 'inner_horn_filling'
- OUTER_HORN_FILLING = 'outer_horn_filling'
- LIFTING_PROPERTY = 'lifting_property'
- FIBRATION_CONDITION = 'fibration_condition'
- HOMOTOPY_EXTENSION = 'homotopy_extension'
- classmethod __contains__(member)
Return True if member is a member of this enum raises TypeError if member is not an enum member
note: in 3.12 TypeError will no longer be raised, and True will also be returned if member is the value of a member in this enum
- classmethod __getitem__(name)
Return the member matching name.
- classmethod __iter__()
Return members in definition order.
- classmethod __len__()
Return the number of members (no aliases)
- class gaia.core.KanConditionResult(condition_type, simplex_id, simplex_name, horn_index, satisfied, confidence, error_message=None, verification_data=<factory>)[source]
Bases:
object
Result of a Kan condition verification.
- __init__(condition_type, simplex_id, simplex_name, horn_index, satisfied, confidence, error_message=None, verification_data=<factory>)
- condition_type: KanConditionType
Submodules
- gaia.core.abstractions module
- gaia.core.business_units module
CommunicationType
BusinessMessage
BusinessUnit
BusinessUnit.__init__()
BusinessUnit.send_message()
BusinessUnit.receive_message()
BusinessUnit.process_inbox()
BusinessUnit.generate_status_report()
BusinessUnit.send_reports_to_superiors()
BusinessUnit.issue_directives_to_subordinates()
BusinessUnit.coordinate_with_peers()
BusinessUnit.get_organizational_metrics()
BusinessUnitHierarchy
BusinessUnitHierarchy.__init__()
BusinessUnitHierarchy.route_message()
BusinessUnitHierarchy.process_all_messages()
BusinessUnitHierarchy.cascade_directive_from_top()
BusinessUnitHierarchy.collect_reports_to_top()
BusinessUnitHierarchy.simulate_business_cycle()
BusinessUnitHierarchy.get_communication_network_analysis()
BusinessUnitHierarchy.visualize_hierarchy()
BusinessUnitHierarchy.add_business_unit()
BusinessUnitHierarchy.get_unit()
BusinessUnitHierarchy.get_units_by_level()
create_business_hierarchy_from_model()
simulate_organizational_learning()
- gaia.core.coalgebras module
- gaia.core.ends_coends module
- gaia.core.functor module
MapType
SimplicialError
HornError
MapConflictError
BasisClashError
FaceExpectationError
SimplicialObjectProtocol
SimplicialFunctor
SimplicialFunctor.__init__()
SimplicialFunctor.__getitem__()
SimplicialFunctor.add()
SimplicialFunctor.define_face()
SimplicialFunctor.define_degeneracy()
SimplicialFunctor.face()
SimplicialFunctor.degeneracy()
SimplicialFunctor.find_horns()
SimplicialFunctor.verify_simplicial_identities()
SimplicialFunctor.diagnose_partial_structure()
SimplicialFunctor.create_object()
SimplicialFunctor.create_morphism()
SimplicialFunctor.create_triangle()
SimplicialFunctor.has_lift()
SimplicialFunctor.state_dict()
SimplicialFunctor.load_state_dict()
SimplicialFunctor.register_endofunctor_update()
SimplicialFunctor.get_endofunctor_trajectory()
SimplicialFunctor.create_coalgebra_structure_map()
- gaia.core.fuzzy module
FuzzySet
FuzzySetMorphism
FuzzyCategory
FuzzySimplicialSet
FuzzySimplicialSet.name
FuzzySimplicialSet.dimension
FuzzySimplicialSet.fuzzy_sets
FuzzySimplicialSet.face_maps
FuzzySimplicialSet.degeneracy_maps
FuzzySimplicialSet.id
FuzzySimplicialSet.__post_init__()
FuzzySimplicialSet.add_simplex()
FuzzySimplicialSet.get_membership()
FuzzySimplicialSet.add_face_map()
FuzzySimplicialSet.add_degeneracy_map()
FuzzySimplicialSet.verify_membership_coherence()
FuzzySimplicialSet.verify_degeneracy_preservation()
FuzzySimplicialSet.__init__()
FuzzySimplicialFunctor
create_discrete_fuzzy_set()
create_gaussian_fuzzy_set()
create_triangular_fuzzy_set()
TConorm
merge_fuzzy_simplicial_sets()
- gaia.core.hierarchical_messaging module
SimplexParameters
LocalObjective
HierarchicalMessagePasser
HierarchicalMessagePasser.__init__()
HierarchicalMessagePasser.add_simplex()
HierarchicalMessagePasser.add_local_objective()
HierarchicalMessagePasser.compute_face_gradient_combination()
HierarchicalMessagePasser.compute_degeneracy_instructions()
HierarchicalMessagePasser.hierarchical_update_step()
HierarchicalMessagePasser.percolate_information_up()
HierarchicalMessagePasser.percolate_information_down()
HierarchicalMessagePasser.full_hierarchical_message_passing()
HierarchicalMessagePasser.get_system_state()
create_triangle_complex()
create_tetrahedron_complex()
- gaia.core.identity module
- gaia.core.integrated_structures module
- gaia.core.kan_extensions module
Category
SetCategory
GenerativeAICategory
Functor
NeuralFunctor
NaturalTransformation
LeftKanExtension
RightKanExtension
MigrationFunctor
FoundationModelBuilder
FoundationModelBuilder.__init__()
FoundationModelBuilder.add_base_category()
FoundationModelBuilder.add_base_functor()
FoundationModelBuilder.build_foundation_model_via_left_kan()
FoundationModelBuilder.build_foundation_model_via_right_kan()
FoundationModelBuilder.apply_model_modification()
FoundationModelBuilder.get_foundation_model()
FoundationModelBuilder.list_models()
create_llm_foundation_model()
create_diffusion_foundation_model()
create_multimodal_foundation_model()
- gaia.core.kan_verification module
- gaia.core.legacy_adapters module
FuzzySetAdapter
FuzzySimplicialSetAdapter
FuzzySimplicialSetAdapter.__init__()
FuzzySimplicialSetAdapter.name
FuzzySimplicialSetAdapter.dimension
FuzzySimplicialSetAdapter.add_simplex()
FuzzySimplicialSetAdapter.get_membership()
FuzzySimplicialSetAdapter.verify_membership_coherence()
FuzzySimplicialSetAdapter.verify_degeneracy_preservation()
CoalgebraAdapter
create_legacy_fuzzy_set()
create_legacy_fuzzy_simplicial_set()
create_legacy_coalgebra()
merge_fuzzy_simplicial_sets()
FuzzySet
FuzzySimplicialSet
FCoalgebra
- gaia.core.metric_yoneda module
- gaia.core.simplices module
- gaia.core.universal_coalgebras module