Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Mircus/HyperCat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

HyperCat Logo

๐Ÿพ HyperCat

A sleek and expressive Python library for modeling categories, functors, natural transformations, and higher categorical structures.

Python Version License: MIT


โœจ Features

  • ๐Ÿ“ฆ Core Structures: Objects, morphisms, categories with full composition laws
  • ๐Ÿ”„ Functors: Map between categories while preserving structure
  • ๐ŸŒ€ Natural Transformations: Morphisms between functors with naturality checking
  • 2๏ธโƒฃ Higher Categories: 2-categories, โˆž-categories, simplicial sets
  • ๐Ÿงฎ Advanced Constructions: Monoidal, braided, enriched categories, and toposes
  • ๐Ÿ”ง Algebraic Structures: Operads and algebras
  • ๐Ÿ“Š Diagram Tools: Automated commutativity checking
  • ๐Ÿ—๏ธ Standard Categories: Pre-built categories (terminal, initial, discrete, etc.)

๐Ÿง  Philosophy

HyperCat brings the mathematical elegance of category theory to Python, designed for:

  • ๐Ÿ“ Research in pure and applied category theory
  • ๐Ÿงฎ Computational modeling of categorical structures
  • ๐Ÿง  Algebraic topology and homotopy theory
  • ๐Ÿค– Categorical foundations for functional programming and type theory
  • ๐Ÿ”ฌ Mathematical foundations for machine learning and AI systems

๐Ÿ› ๏ธ Installation

From Source (Recommended)

git clone https://github.com/Mircus/HyperCat.git

cd HyperCat
pip install -e .

Requirements

  • Python 3.8 or higher
  • Dependencies: networkx, matplotlib, jupyter, pytest

๐Ÿ“š Quick Start

Basic Usage

import hypercat
from hypercat import Category, Object, Morphism, Functor

# Create a category
cat = Category("Sets")

# Add objects
A = Object("A")
B = Object("B")
cat.add_object(A)
cat.add_object(B)

# Add morphisms
f = Morphism("f", A, B)
cat.add_morphism(f)

# Compose morphisms
g = Morphism("g", B, A)
cat.add_morphism(g)
h = cat.compose(f, g)  # h: A โ†’ A

print(f"Composed morphism: {h}")

Functors

# Create another category
cat2 = Category("Groups")
cat2.add_object(A)
cat2.add_object(B)
cat2.add_morphism(f)

# Create a functor
F = Functor("F", cat, cat2)
F.map_object(A, A)
F.map_object(B, B)
F.map_morphism(f, f)

# Check functor laws
print(f"Preserves composition: {F.is_functor()}")

Natural Transformations

from hypercat import NaturalTransformation

# Create two functors F, G: cat โ†’ cat2
G = Functor("G", cat, cat2)
# ... set up G's mappings ...

# Create natural transformation ฮท: F โ‡’ G
eta = NaturalTransformation("ฮท", F, G)
# ... set up components ...

# Verify naturality
print(f"Is natural: {eta.is_natural()}")

Standard Categories

from hypercat import StandardCategories

# Pre-built categories
terminal = StandardCategories.terminal_category()  # Single object, single morphism
initial = StandardCategories.initial_category()    # Empty category
discrete = StandardCategories.discrete_category(["X", "Y", "Z"])  # Only identity morphisms

๐Ÿ“– Documentation

Interactive Examples

Start with our interactive Jupyter notebooks in the examples/ directory:

Module Structure

hypercat/
โ”œโ”€โ”€ core/           # Core classes: Category, Object, Morphism, Functor
โ”œโ”€โ”€ categories/     # Specialized categories: Monoidal, Braided, Enriched, Topos
โ”œโ”€โ”€ higher/         # Higher categories: 2-categories, โˆž-categories
โ”œโ”€โ”€ diagram/        # Diagram and commutativity checking tools
โ””โ”€โ”€ algebraic/      # Operads and algebraic structures

Key Classes

  • Category: The fundamental structure with objects and morphisms
  • Functor: Structure-preserving mappings between categories
  • NaturalTransformation: Morphisms between functors
  • TwoCategory: Categories with 2-cells (morphisms between morphisms)
  • MonoidalCategory: Categories with tensor products
  • Topos: Categories with all finite limits and power objects

๐Ÿงช Testing

Run the test suite:

pytest

๐Ÿ”ญ Roadmap

See ROADMAP.md for planned features:

  • Universal properties and (co)limits
  • Kan extensions
  • Model categories
  • Higher topos theory
  • Categorical logic
  • Integration with proof assistants

๐Ÿ”ญ What's Next?

Check out our ROADMAP.md for upcoming features, including:

  • (Co)limits and universal constructions
  • Functorial logic and transformation categories

๐Ÿค Contribute

We welcome contributions! See CONTRIBUTING.md for how to get started.


๐Ÿงต Motto

"The fabric of higher structures"

About

a python library for cats and hypercats

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages