Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Before modifying code, agents MUST read:

- `AGENTS.md` (this file)
- **All files in `docs/dev/*.md`** – repository development rules
- `docs/project.md` – module layout and architecture
- `docs/code_organization.md` – module layout and architecture

The `docs/dev/` directory contains the authoritative development guidance for this repository. Agents must load every file in that directory before making changes.

Expand Down Expand Up @@ -92,6 +92,14 @@ When using the `gh` CLI to view issues, PRs, or other GitHub objects:
- **ALWAYS** use the patch editing mechanism provided by the agent
- Shell text tools may be used for **read‑only analysis only**

### Public API Preludes

- Keep `prelude::*` small and focused on common quick-start workflows.
- Keep scoped preludes minimal and orthogonal; do not duplicate specialized APIs across scoped preludes unless the overlap is intentionally documented.
- `prelude::observables` is the user-facing analysis surface for measuring triangulations and derived physical observables.
- `prelude::simulation` is for running, inspecting, and debugging simulations; it may expose telemetry and proposal/result types, but should not become the home for user-facing observable estimators.
- Detailed prelude boundary guidance lives in `docs/dev/rust.md`.

### Commit Message Generation

When generating commit messages:
Expand Down Expand Up @@ -163,16 +171,16 @@ Key principle:
- **Edition**: 2024
- **Unsafe code**: forbidden (`#![forbid(unsafe_code)]`)
- **Architecture**: CDT physics layered over a pluggable geometry backend (`delaunay` crate). Direct `use delaunay::` imports are restricted to `src/geometry/` (`backends/delaunay.rs` and `generators.rs`); all other modules use the trait-based abstractions and `DelaunayBackend2D` type alias (see `docs/dev/rust.md § Geometry Backend Isolation`)
- **Modules**: `src/cdt/` (CDT logic: moves, action, Metropolis, foliation), `src/geometry/` (geometry abstractions and backends), `src/config.rs` (simulation configuration)
- **Foliation**: `src/cdt/foliation.rs` assigns per-vertex time labels via `VertexSecondaryMap`; `from_foliated_cylinder` constructs foliated triangulations; `validate_causality` enforces |Δt| ≤ 1 on edges. Design documented in `docs/foliation.md`
- **Ergodic moves**: `attempt_22_move`, `attempt_13_move`, `attempt_31_move`, `attempt_edge_flip` are currently placeholder implementations; full `delaunay::Tds` integration is planned
- **Modules**: `src/cdt/` (CDT logic: moves, action, Metropolis, foliation, observables), `src/geometry/` (geometry abstractions and backends), `src/config.rs` (simulation configuration)
- **Foliation**: `src/cdt/foliation.rs` defines foliation bookkeeping and edge/cell classification. Time labels are stored as vertex data; `from_cdt_strip` and `from_toroidal_cdt` construct labeled CDT triangulations; `validate_causality` enforces adjacent-slice edges (with circular distance on toroidal time). Design documented in `docs/foliation.md`
- **Ergodic moves**: `attempt_22_move`, `attempt_13_move`, `attempt_31_move`, `attempt_edge_flip` are Delaunay-backed, foliation-aware move kernels. They mutate through narrow CDT-owned edit operations, roll back failed finalized mutations, and preserve topology/foliation invariants
- **Python scripts**: `scripts/` contains benchmark, changelog, and hardware utilities; tests in `scripts/tests/` run via pytest
- **When adding/removing files**: Update `docs/project.md`
- **When adding/removing files**: Update `docs/code_organization.md`

Architecture details are documented in:

```text
docs/project.md
docs/code_organization.md
```

---
Expand Down
51 changes: 21 additions & 30 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Thank you for your interest in contributing to the [**causal-triangulations**][c
- [Code of Conduct](#code-of-conduct)
- [Getting Started](#getting-started)
- [Development Environment Setup](#development-environment-setup)
- [Project Structure](#project-structure)
- [Code Organization](#code-organization)
- [Development Workflow](#development-workflow)
- [Just Command Runner](#just-command-runner)
- [Code Style and Standards](#code-style-and-standards)
Expand Down Expand Up @@ -145,36 +145,9 @@ info: downloading component 'clippy'

This is normal and only happens once.

## Project Structure
## Code Organization

```text
causal-triangulations/
├── src/ # Core library code
│ ├── cdt/ # CDT-specific implementations
│ │ ├── action.rs # Regge action calculations
│ │ ├── metropolis.rs # Monte Carlo simulation
│ │ ├── ergodic_moves.rs # Pachner moves
│ │ └── triangulation.rs # CDT triangulation wrapper
│ ├── geometry/ # Geometry abstraction layer
│ │ ├── backends/ # Geometry backend implementations
│ │ ├── mesh.rs # Mesh data structures
│ │ ├── operations.rs # High-level operations
│ │ └── traits.rs # Geometry traits
│ ├── config.rs # Configuration management
│ ├── errors.rs # Error types
│ ├── util.rs # Utility functions
│ ├── lib.rs # Library root
│ └── main.rs # CLI binary
├── examples/ # Usage examples
│ ├── basic_cdt.rs # Library usage example
│ └── scripts/ # Ready-to-use simulation scripts
├── tests/ # Test suite
│ ├── cli.rs # CLI integration tests
│ └── integration_tests.rs # System integration tests
├── benches/ # Performance benchmarks
├── docs/ # Documentation
└── justfile # Task automation
```
The source/module layout and architecture-sensitive boundaries live in [docs/code_organization.md](docs/code_organization.md). Keep that file current when adding, removing, or moving source files, examples, or architecture-significant modules.

## Development Workflow

Expand Down Expand Up @@ -203,6 +176,24 @@ just --list # Show all available commands
just help-workflows # Detailed workflow guidance
```

### Repository Tooling Map

```text
.github/workflows/codeql.yml # CodeQL analysis for Actions and Rust
.github/workflows/semgrep-sarif.yml # Repository Semgrep rule SARIF upload
rustfmt.toml # Stable Rust formatting settings
cliff.toml # git-cliff changelog template and commit grouping
semgrep.yaml # Repository-owned Semgrep rules
docs/dev/python.md # Python script style and validation guidance
docs/dev/tooling-alignment.md # Tooling comparison and issue #112 decisions
docs/roadmap.md # High-level release direction and non-goals
tests/semgrep/ # Semgrep rule fixtures run by `just semgrep-test`
scripts/archive_changelog.py # Split completed changelog minor series into archive files
scripts/coverage_report.py # Cobertura coverage summary helper
scripts/postprocess_changelog.py # Markdown hygiene for git-cliff changelogs
scripts/tag_release.py # Annotated release tags from root or archived changelog sections
```

### Typical Development Cycle

1. **Start working on a feature/fix**:
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version = "0.0.1"
authors = [ "Adam Getchell <adam@adamgetchell.org>" ]
categories = [ "science", "mathematics", "algorithms", "simulation" ]
edition = "2024"
documentation = "https://docs.rs/causal-triangulations"
homepage = "https://github.com/acgetchell/causal-triangulations"
keywords = [
"quantum-gravity",
Expand Down
37 changes: 14 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,23 @@ The library leverages high-performance [Delaunay triangulation] backends and pro

## ✨ Features

- [x] 2D Causal Dynamical Triangulations with time-foliation (early implementation)
- [x] Metropolis-Hastings simulation loop with proposal-before-mutation move ordering
- [x] Regge action calculation with configurable coupling constants (experimental)
- [x] Ergodic moves (Alexander/Pachner moves) with causal constraints (experimental)
- [x] Command-line interface for simulation workflows (early)
- [x] Benchmarking and performance analysis infrastructure (in progress)
- [x] Cross-platform compatibility (Linux, macOS, Windows)
- [x] Explicit 1+1 CDT strip and toroidal S¹×S¹ constructors with foliation invariants
- [x] Foliation-aware topology, causality, and cell-classification validation
- [x] Proposal-before-mutation Metropolis-Hastings simulation with rollback on failed accepted moves
- [x] Regge action calculation with configurable coupling constants
- [x] Alexander/Pachner-style local move proposals with causal constraints
- [x] Volume-profile, Hausdorff-dimension, and spectral-dimension observables for CDT analysis
- [x] Focused public preludes for simulation, triangulation, geometry, action, and observables
- [x] Command-line interface, examples, Criterion benchmarks, and CI-aligned validation tooling
- [x] Cross-platform compatibility: Linux, macOS, Windows

See [CHANGELOG.md](CHANGELOG.md) for release history.

## 🚧 Project Status

🚧 **Pre-release (0.0.x)** — This crate is under active development and **not yet ready for production use**. APIs, data structures, and module boundaries may change without notice.
🚧 **Pre-release (0.0.x)** — The 1+1 CDT foundation is implemented and tested, but this crate is still under active development and **not yet ready for production use**. APIs, data structures, and module boundaries may change before v0.1.0.

The library currently supports an initial 2D CDT implementation, with planned extensions to 3D and 4D.
The library currently supports validated 1+1 CDT construction, foliation checks, Metropolis sampling, and core observables. Higher-dimensional CDT support, full move-kernel maturity, visualization/export workflows, and advanced ensemble-analysis helpers remain roadmap work.

See [`docs/roadmap.md`](docs/roadmap.md) for current direction, near-term candidates, and non-goals.

Expand Down Expand Up @@ -180,34 +182,23 @@ See [`benches/README.md`](benches/README.md) for benchmark details and [`docs/PE

## 🛣️ Roadmap

- [x] Integrate an existing Rust **Delaunay** triangulation library (e.g., [`delaunay`](https://crates.io/crates/delaunay))
- [x] 2D Delaunay triangulation scaffold
- [ ] 1+1 foliation (causal time‑slicing)
- [ ] 2D ergodic moves (Alexander/Pachner moves with causal constraints, fully validated)
- [ ] 2D Metropolis–Hastings (stabilized on `markov-chain-monte-carlo` delayed proposals)
- [ ] Diffusion‑accelerated MCMC (exploration)
- [ ] Basic visualization hooks (export to common mesh formats)
- [ ] 3D Delaunay + 2+1 foliation + moves + M–H
- [ ] 4D Delaunay + 3+1 foliation + moves + M–H
- [ ] Mass initialization via **Constrained Delaunay** in 3D/4D
- [ ] Shortest paths & geodesic distance
- [ ] Curvature estimates / Einstein tensor (discrete Regge‑like observables)
The high-level roadmap, including 1+1 maturity work, future 2+1 and 3+1 CDT topology tracks, observables, dual/Voronoi geometry, visualization, and non-goals, lives in [`docs/roadmap.md`](docs/roadmap.md).

## Design notes

- **Separation of concerns**: geometry primitives (Delaunay/Voronoi) are decoupled from CDT dynamics.
- **Foliation‑aware data model**: explicit time labels; space‑like vs time‑like edges encoded in types.
- **Testing**: unit + property tests for invariants (e.g., move reversibility, manifoldness).

For comprehensive guidelines on contributing, development environment setup, testing, and project structure, please see [CONTRIBUTING.md](CONTRIBUTING.md).
For comprehensive guidelines on contributing, development environment setup, testing, and code organization, please see [CONTRIBUTING.md](CONTRIBUTING.md).

This includes information about:

- Building and testing the library
- Running benchmarks and performance analysis
- Code style and standards
- Submitting changes and pull requests
- Project structure and development tools
- Code organization and development tools

## 📚 References

Expand Down
12 changes: 11 additions & 1 deletion REFERENCES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: "References and Citations"
description: "Academic references and bibliographic citations used throughout the causal-triangulations library"
keywords: ["references", "citations", "causal dynamical triangulations", "quantum gravity", "bibliography"]
author: "Adam Getchell"
date: "2025-10-07"
date: "2026-05-06"
category: "Documentation"
tags: ["academic", "research", "citations", "physics", "quantum gravity"]
layout: "page"
Expand Down Expand Up @@ -38,6 +38,16 @@ This section contains the seminal papers and foundational work that established

- Ambjørn, J., Görlich, A., Jurkiewicz, J., and Loll, R. "Nonperturbative Quantum Gravity." _Physics Reports_ 519, no. 4-5 (2012): 127-210. DOI: [10.1016/j.physrep.2012.03.007](https://doi.org/10.1016/j.physrep.2012.03.007). arXiv: [1203.3591](https://arxiv.org/abs/1203.3591)

### Volume Profiles and Dimensional Observables

- Ambjørn, J., Jurkiewicz, J., and Loll, R. "Reconstructing the Universe." _Physical Review D_ 72, no. 6 (2005): 064014. DOI: [10.1103/PhysRevD.72.064014](https://doi.org/10.1103/PhysRevD.72.064014). arXiv: [hep-th/0505154](https://arxiv.org/abs/hep-th/0505154)

- Ambjørn, J., Jurkiewicz, J., and Loll, R. "The Spectral Dimension of the Universe is Scale Dependent." _Physical Review Letters_ 95, no. 17 (2005): 171301. DOI: [10.1103/PhysRevLett.95.171301](https://doi.org/10.1103/PhysRevLett.95.171301). arXiv: [hep-th/0505113](https://arxiv.org/abs/hep-th/0505113)

- Ambjørn, J., Budd, T., and Watabiki, Y. "Scale-dependent Hausdorff dimensions in 2d gravity." _Physics Letters B_ 736 (2014): 339-343. DOI: [10.1016/j.physletb.2014.07.047](https://doi.org/10.1016/j.physletb.2014.07.047). arXiv: [1406.6251](https://arxiv.org/abs/1406.6251)

- van der Duin, J., Loll, R., Schiffer, M., and Silva, A. "Quantum gravity and effective topology." _The European Physical Journal C_ 86, no. 2 (2026): 102. DOI: [10.1140/epjc/s10052-026-15322-x](https://doi.org/10.1140/epjc/s10052-026-15322-x)

## Monte Carlo Methods in Quantum Gravity

These references provide the algorithmic foundations for Monte Carlo simulations in discrete quantum gravity.
Expand Down
3 changes: 3 additions & 0 deletions benches/cdt_benchmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,20 +338,23 @@ fn bench_simulation_analysis(c: &mut Criterion) {
vertices: 15,
edges: 32,
triangles: 18,
volume_profile: vec![9, 9, 0],
},
Measurement {
step: 10,
action: 11.8,
vertices: 16,
edges: 34,
triangles: 19,
volume_profile: vec![9, 10, 0],
},
Measurement {
step: 20,
action: 12.1,
vertices: 15,
edges: 31,
triangles: 17,
volume_profile: vec![8, 9, 0],
},
],
elapsed_time: Duration::from_millis(37),
Expand Down
2 changes: 1 addition & 1 deletion docs/PERFORMANCE_TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ just perf-check
# Strict 5% threshold for critical changes
just perf-check 5.0

# Relaxed 15% threshold for experimental features
# Relaxed 15% threshold for exploratory changes
just perf-check 15.0
```

Expand Down
Loading
Loading