csw-core 0.1.0

Core categorical structures for the Categorical Semantics Workbench - define categories and derive type systems
Documentation
//! # csw-core
//!
//! Core categorical structures for the Categorical Semantics Workbench.
//!
//! This crate provides the foundational types for specifying categorical structures
//! (products, coproducts, exponentials, tensor products, etc.) and their properties.
//! From these specifications, type systems can be automatically derived using the
//! Curry-Howard-Lambek correspondence.
//!
//! ## Overview
//!
//! The Categorical Semantics Workbench operationalizes the insight that:
//! - **Logic** ↔ **Type Theory** ↔ **Category Theory**
//!
//! Given a categorical structure, we can mechanically derive the corresponding
//! type system, and vice versa.
//!
//! ## Example
//!
//! ```rust
//! use csw_core::CategoryBuilder;
//!
//! // Define a Cartesian Closed Category (CCC)
//! // This will derive the Simply-Typed Lambda Calculus
//! let ccc = CategoryBuilder::new("STLC")
//!     .with_base("Int")
//!     .with_base("Bool")
//!     .with_terminal()
//!     .with_products()
//!     .with_exponentials()
//!     .cartesian()
//!     .build()
//!     .expect("valid CCC specification");
//! ```
//!
//! ## Categorical Structures and Their Logics
//!
//! | Structure | Logic/Type System |
//! |-----------|-------------------|
//! | Cartesian Closed Category | Simply-typed λ-calculus |
//! | Bicartesian Closed Category | λ-calculus with sums |
//! | Symmetric Monoidal Closed Category | Linear λ-calculus |
//! | Affine Category | Affine types (Rust-like) |

#![warn(missing_docs)]
#![warn(rustdoc::missing_crate_level_docs)]

mod category;
mod builder;
mod error;

// Placeholder modules for future implementation
mod structures;
mod validation;

pub use category::*;
pub use builder::*;
pub use error::*;

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_ccc_construction() {
        let result = CategoryBuilder::new("STLC")
            .with_terminal()
            .with_products()
            .with_exponentials()
            .cartesian()
            .build();

        assert!(result.is_ok());
    }
}