gaia.core.functor module
Module: functor Defines the SimplicialFunctor class representing a functor from Δᵒᵖ to Param.
Following Mahadevan (2024), this implements a complete simplicial functor X: Δᵒᵖ → Param where every [n] ∈ Δ is mapped to X([n]) = <d_n>.
This implementation follows pure category theory principles: 1. The functor DEFINES structure, never discovers it 2. Simplicial identities are verified globally, not locally 3. Horn detection queries structure directly 4. Explicit structure definition methods are provided 5. Complete lifting problem validation
- class gaia.core.functor.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.functor.SimplicialError[source]
Bases:
Exception
Base class for simplicial functor errors.
- __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.
- exception gaia.core.functor.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.
- exception gaia.core.functor.MapConflictError[source]
Bases:
SimplicialError
Error raised when there’s a conflict in map registration.
- __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.
- exception gaia.core.functor.BasisClashError[source]
Bases:
SimplicialError
Error raised when there’s a basis clash.
- __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.
- exception gaia.core.functor.FaceExpectationError[source]
Bases:
SimplicialError
Error raised when a registered face doesn’t match expected one.
- __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.functor.SimplicialObjectProtocol(*args, **kwargs)[source]
Bases:
Protocol
Protocol defining the interface for simplicial objects.
- 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.functor.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.
- 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.
- 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.
- face(index, simplex_id)[source]
Get the face of a simplex at the given index. Queries the functor’s defined structure directly.
- degeneracy(index, simplex_id)[source]
Get the degeneracy 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.
- 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
- 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.
- 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_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_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.
- 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.