csw_core/lib.rs
1//! # csw-core
2//!
3//! Core categorical structures for the Categorical Semantics Workbench.
4//!
5//! This crate provides the foundational types for specifying categorical structures
6//! (products, coproducts, exponentials, tensor products, etc.) and their properties.
7//! From these specifications, type systems can be automatically derived using the
8//! Curry-Howard-Lambek correspondence.
9//!
10//! ## Overview
11//!
12//! The Categorical Semantics Workbench operationalizes the insight that:
13//! - **Logic** ↔ **Type Theory** ↔ **Category Theory**
14//!
15//! Given a categorical structure, we can mechanically derive the corresponding
16//! type system, and vice versa.
17//!
18//! ## Example
19//!
20//! ```rust
21//! use csw_core::CategoryBuilder;
22//!
23//! // Define a Cartesian Closed Category (CCC)
24//! // This will derive the Simply-Typed Lambda Calculus
25//! let ccc = CategoryBuilder::new("STLC")
26//! .with_base("Int")
27//! .with_base("Bool")
28//! .with_terminal()
29//! .with_products()
30//! .with_exponentials()
31//! .cartesian()
32//! .build()
33//! .expect("valid CCC specification");
34//! ```
35//!
36//! ## Categorical Structures and Their Logics
37//!
38//! | Structure | Logic/Type System |
39//! |-----------|-------------------|
40//! | Cartesian Closed Category | Simply-typed λ-calculus |
41//! | Bicartesian Closed Category | λ-calculus with sums |
42//! | Symmetric Monoidal Closed Category | Linear λ-calculus |
43//! | Affine Category | Affine types (Rust-like) |
44
45#![warn(missing_docs)]
46#![warn(rustdoc::missing_crate_level_docs)]
47
48mod category;
49mod builder;
50mod error;
51
52// Placeholder modules for future implementation
53mod structures;
54mod validation;
55
56pub use category::*;
57pub use builder::*;
58pub use error::*;
59
60#[cfg(test)]
61mod tests {
62 use super::*;
63
64 #[test]
65 fn test_ccc_construction() {
66 let result = CategoryBuilder::new("STLC")
67 .with_terminal()
68 .with_products()
69 .with_exponentials()
70 .cartesian()
71 .build();
72
73 assert!(result.is_ok());
74 }
75}