zigzag-engine/src/lib.rs
Maximus Gorog 5d21c75178 Implement k-points explosion and poset structure
Complete the explosion module for layout computation:

- Poset methods: is_less_than, less_than_or_equal, is_comparable,
  minimal_elements, maximal_elements, topological_sort
- Covering relations: compute_covers() from poset ordering
- k_points: Full implementation with proper covering relation computation
- Point ordering: Product ordering on height labels with zigzag structure
- HeightLabel ordering: r_j < s_j < r_{j+1} within each dimension
- Injectification stub for future layout integration

The poset structure captures the combinatorial data needed for
embedding Pt_n(X) -> R^n in the layout algorithm.

All 55 tests pass.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-07 03:03:38 -06:00

48 lines
1.7 KiB
Rust

//! Zigzag Engine: Standalone library for associative n-categories
//!
//! This library implements the zigzag construction and normalisation algorithm
//! from "Zigzag normalisation for associative n-categories" (Heidemann, Reutter, Vicary, LICS 2022).
//!
//! # Overview
//!
//! The zigzag construction provides a combinatorial model of higher categories where:
//! - Objects are n-diagrams (iterated zigzags over natural numbers)
//! - Morphisms are zigzag maps (structure-preserving transformations)
//! - Normalisation removes redundant identity structure while preserving essential identities
//!
//! # Core Concepts
//!
//! - [`MonotoneMap`]: Order-preserving maps between finite ordinals
//! - [`Zigzag`]: A sequence of cospans with alternating regular/singular objects
//! - [`Diagram`]: An n-diagram in the iterated zigzag category
//! - [`Rewrite`]: A zigzag map between diagrams
//!
//! # Example
//!
//! ```ignore
//! use zigzag_engine::{Diagram, normalise};
//!
//! let diagram: Diagram = /* construct diagram */;
//! let result = diagram.normalise();
//! assert!(result.normal_form.is_normalised());
//! ```
pub mod monotone;
pub mod zigzag;
pub mod diagram;
pub mod signature;
pub mod degeneracy;
pub mod normalise;
pub mod typecheck;
pub mod explosion;
pub mod layout;
// Re-exports for convenience
pub use monotone::MonotoneMap;
pub use zigzag::{Zigzag, ZigzagMap};
pub use diagram::{Diagram, DiagramN, Cospan, Rewrite, Cone};
pub use signature::{Generator, Signature};
pub use normalise::{NormalisationResult, normalise, normalise_sink};
pub use typecheck::{TypeError, type_check};
pub use explosion::{Point, HeightLabel, Poset, InjectificationResult, injectify};
pub use layout::{Layout, LayoutConstraints, SpringConstraint};