diff --git a/crates/trios-physics/AGENTS.md b/crates/trios-physics/AGENTS.md new file mode 100644 index 0000000000..6bba21b69e --- /dev/null +++ b/crates/trios-physics/AGENTS.md @@ -0,0 +1,21 @@ +# AGENTS.md โ€” trios-physics + +> AAIF-compliant | MCP-compatible + +- Crate: trios-physics (Gold) +- Repo: gHashTag/trios + +## Ring map + +| Ring | Package | Role | +|------|---------|------| +| PH-00 | trios-physics-ph00 | physical constants | +| PH-01 | trios-physics-ph01 | equations | +| BR-OUTPUT | trios-physics-br-output | assembly | + +## Rules + +- L-ARCH-001 future logic in rings/ +- R9: no sibling imports +- L6: pure Rust +- Anchor: phi^2 + phi^-2 = 3 diff --git a/crates/trios-physics/RING.md b/crates/trios-physics/RING.md new file mode 100644 index 0000000000..c70ce437cb --- /dev/null +++ b/crates/trios-physics/RING.md @@ -0,0 +1,29 @@ +# RING โ€” trios-physics (Gold Crate) + +| Field | Value | +|-------|-------| +| Metal | ๐Ÿฅ‡ Gold | +| Type | Crate | + +## Purpose + +Physical constants and equations (quantum, QCD, gravity). +Foundation for physics simulations across TRIOS. + +## Ring Structure + +``` +crates/trios-physics/ +โ”œโ”€โ”€ src/lib.rs โ† preserved (FFI to zig-physics) +โ””โ”€โ”€ rings/ + โ”œโ”€โ”€ PH-00/ โ† physical constants (c, h, G, alpha) + โ”œโ”€โ”€ PH-01/ โ† equations (E=mc^2, lambda=h/p) + โ””โ”€โ”€ BR-OUTPUT/ โ† assembly +``` + +`BR-OUTPUT โ†’ PH-01 โ†’ PH-00`. R9 satisfied. + +## Laws + +- L-ARCH-001 / R1โ€“R5 / R9 / L6 +- Anchor: `phi^2 + phi^-2 = 3` diff --git a/crates/trios-physics/rings/BR-OUTPUT/AGENTS.md b/crates/trios-physics/rings/BR-OUTPUT/AGENTS.md new file mode 100644 index 0000000000..d6eeef4c77 --- /dev/null +++ b/crates/trios-physics/rings/BR-OUTPUT/AGENTS.md @@ -0,0 +1,3 @@ +# AGENTS.md โ€” BR-OUTPUT (trios-physics) + +May import PH-00, PH-01. L6: pure Rust. diff --git a/crates/trios-physics/rings/BR-OUTPUT/Cargo.lock b/crates/trios-physics/rings/BR-OUTPUT/Cargo.lock new file mode 100644 index 0000000000..e20a7021c8 --- /dev/null +++ b/crates/trios-physics/rings/BR-OUTPUT/Cargo.lock @@ -0,0 +1,22 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "trios-physics-br-output" +version = "0.1.0" +dependencies = [ + "trios-physics-ph00", + "trios-physics-ph01", +] + +[[package]] +name = "trios-physics-ph00" +version = "0.1.0" + +[[package]] +name = "trios-physics-ph01" +version = "0.1.0" +dependencies = [ + "trios-physics-ph00", +] diff --git a/crates/trios-physics/rings/BR-OUTPUT/Cargo.toml b/crates/trios-physics/rings/BR-OUTPUT/Cargo.toml new file mode 100644 index 0000000000..bf346983e5 --- /dev/null +++ b/crates/trios-physics/rings/BR-OUTPUT/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "trios-physics-br-output" +version = "0.1.0" +edition = "2021" +authors = ["Dmitrii Vasilev"] +license = "MIT" +description = "BR-OUTPUT โ€” assembly for trios-physics" +publish = false + +[dependencies] +trios-physics-ph00 = { path = "../PH-00" } +trios-physics-ph01 = { path = "../PH-01" } + +[workspace] diff --git a/crates/trios-physics/rings/BR-OUTPUT/README.md b/crates/trios-physics/rings/BR-OUTPUT/README.md new file mode 100644 index 0000000000..27ec52ea87 --- /dev/null +++ b/crates/trios-physics/rings/BR-OUTPUT/README.md @@ -0,0 +1,3 @@ +# BR-OUTPUT โ€” trios-physics + +Re-exports PH-00 + PH-01. diff --git a/crates/trios-physics/rings/BR-OUTPUT/RING.md b/crates/trios-physics/rings/BR-OUTPUT/RING.md new file mode 100644 index 0000000000..6f58f0155f --- /dev/null +++ b/crates/trios-physics/rings/BR-OUTPUT/RING.md @@ -0,0 +1,3 @@ +# RING โ€” BR-OUTPUT (trios-physics) + +Top of ring graph. Imports PH-00, PH-01. diff --git a/crates/trios-physics/rings/BR-OUTPUT/TASK.md b/crates/trios-physics/rings/BR-OUTPUT/TASK.md new file mode 100644 index 0000000000..4cbddbee19 --- /dev/null +++ b/crates/trios-physics/rings/BR-OUTPUT/TASK.md @@ -0,0 +1,8 @@ +# TASK โ€” BR-OUTPUT (trios-physics) + +## Status: SCAFFOLDED +- [x] Re-export PH-00, PH-01 +- [x] Physics::anchor + +## Open +- [ ] MCP tool definitions diff --git a/crates/trios-physics/rings/BR-OUTPUT/src/lib.rs b/crates/trios-physics/rings/BR-OUTPUT/src/lib.rs new file mode 100644 index 0000000000..7f23f1c6d4 --- /dev/null +++ b/crates/trios-physics/rings/BR-OUTPUT/src/lib.rs @@ -0,0 +1,24 @@ +//! BR-OUTPUT โ€” trios-physics assembly + +pub use trios_physics_ph00::{ALPHA, C, G, H, HBAR}; +pub use trios_physics_ph01::{de_broglie_wavelength, rest_energy}; + +pub struct Physics; + +impl Physics { + pub const fn anchor() -> f64 { + 3.0 + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn rings_link() { + let e = rest_energy(1.0); + assert!(e > 0.0); + assert_eq!(Physics::anchor(), 3.0); + } +} diff --git a/crates/trios-physics/rings/PH-00/AGENTS.md b/crates/trios-physics/rings/PH-00/AGENTS.md new file mode 100644 index 0000000000..e5c0a98778 --- /dev/null +++ b/crates/trios-physics/rings/PH-00/AGENTS.md @@ -0,0 +1,6 @@ +# AGENTS.md โ€” PH-00 + +- Package: trios-physics-ph00 +- R1: no PH-01/BR-OUTPUT +- R9: no sibling imports +- L6: pure Rust diff --git a/crates/trios-physics/rings/PH-00/Cargo.lock b/crates/trios-physics/rings/PH-00/Cargo.lock new file mode 100644 index 0000000000..888506cfa7 --- /dev/null +++ b/crates/trios-physics/rings/PH-00/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "trios-physics-ph00" +version = "0.1.0" diff --git a/crates/trios-physics/rings/PH-00/Cargo.toml b/crates/trios-physics/rings/PH-00/Cargo.toml new file mode 100644 index 0000000000..e0c4787518 --- /dev/null +++ b/crates/trios-physics/rings/PH-00/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "trios-physics-ph00" +version = "0.1.0" +edition = "2021" +authors = ["Dmitrii Vasilev"] +license = "MIT" +description = "PH-00 โ€” physical constants" +publish = false + +[workspace] diff --git a/crates/trios-physics/rings/PH-00/README.md b/crates/trios-physics/rings/PH-00/README.md new file mode 100644 index 0000000000..9d9c81d7ae --- /dev/null +++ b/crates/trios-physics/rings/PH-00/README.md @@ -0,0 +1,6 @@ +# PH-00 โ€” physical constants + +Bottom of the ring graph for trios-physics. + +## API +- `C`, `H`, `HBAR`, `G`, `ALPHA` diff --git a/crates/trios-physics/rings/PH-00/RING.md b/crates/trios-physics/rings/PH-00/RING.md new file mode 100644 index 0000000000..06a3812233 --- /dev/null +++ b/crates/trios-physics/rings/PH-00/RING.md @@ -0,0 +1,11 @@ +# RING โ€” PH-00 (trios-physics) + +| Metal | ๐Ÿฅˆ Silver | +| Package | trios-physics-ph00 | + +Physical constants. Bottom of dependency graph. + +## Laws +- R1: no PH-01/BR-OUTPUT +- R9: no sibling imports +- L6: pure Rust diff --git a/crates/trios-physics/rings/PH-00/TASK.md b/crates/trios-physics/rings/PH-00/TASK.md new file mode 100644 index 0000000000..3152b83756 --- /dev/null +++ b/crates/trios-physics/rings/PH-00/TASK.md @@ -0,0 +1,9 @@ +# TASK โ€” PH-00 + +## Status: SCAFFOLDED +- [x] C, H, HBAR, G, ALPHA +- [x] Tests + +## Open +- [ ] Add k_B (Boltzmann), N_A (Avogadro) +- [ ] Migrate constants from `crates/trios-physics/src/` diff --git a/crates/trios-physics/rings/PH-00/src/lib.rs b/crates/trios-physics/rings/PH-00/src/lib.rs new file mode 100644 index 0000000000..6694a0c9a6 --- /dev/null +++ b/crates/trios-physics/rings/PH-00/src/lib.rs @@ -0,0 +1,35 @@ +//! PH-00 โ€” physical constants +//! +//! Bottom of the ring graph for trios-physics. +//! SI units throughout. + +/// Speed of light in vacuum (m/s). +pub const C: f64 = 299_792_458.0; + +/// Planck constant (Jยทs). +pub const H: f64 = 6.626_070_15e-34; + +/// Reduced Planck constant (Jยทs). +pub const HBAR: f64 = 1.054_571_817e-34; + +/// Newtonian gravitational constant (m^3 / (kgยทs^2)). +pub const G: f64 = 6.674_30e-11; + +/// Fine-structure constant (dimensionless). +pub const ALPHA: f64 = 7.297_352_5693e-3; + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn c_is_si_value() { + assert!((C - 299_792_458.0).abs() < 1.0); + } + + #[test] + fn alpha_inverse_close_to_137() { + let inv = 1.0 / ALPHA; + assert!((inv - 137.035_999_084).abs() < 1e-6); + } +} diff --git a/crates/trios-physics/rings/PH-01/AGENTS.md b/crates/trios-physics/rings/PH-01/AGENTS.md new file mode 100644 index 0000000000..dedc8ec810 --- /dev/null +++ b/crates/trios-physics/rings/PH-01/AGENTS.md @@ -0,0 +1,6 @@ +# AGENTS.md โ€” PH-01 + +- Package: trios-physics-ph01 +- R1: no BR-OUTPUT +- May import PH-00 only +- L6: pure Rust diff --git a/crates/trios-physics/rings/PH-01/Cargo.lock b/crates/trios-physics/rings/PH-01/Cargo.lock new file mode 100644 index 0000000000..2dec12a035 --- /dev/null +++ b/crates/trios-physics/rings/PH-01/Cargo.lock @@ -0,0 +1,14 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "trios-physics-ph00" +version = "0.1.0" + +[[package]] +name = "trios-physics-ph01" +version = "0.1.0" +dependencies = [ + "trios-physics-ph00", +] diff --git a/crates/trios-physics/rings/PH-01/Cargo.toml b/crates/trios-physics/rings/PH-01/Cargo.toml new file mode 100644 index 0000000000..e18c206e55 --- /dev/null +++ b/crates/trios-physics/rings/PH-01/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "trios-physics-ph01" +version = "0.1.0" +edition = "2021" +authors = ["Dmitrii Vasilev"] +license = "MIT" +description = "PH-01 โ€” physics equations" +publish = false + +[dependencies] +trios-physics-ph00 = { path = "../PH-00" } + +[workspace] diff --git a/crates/trios-physics/rings/PH-01/README.md b/crates/trios-physics/rings/PH-01/README.md new file mode 100644 index 0000000000..d0c347468d --- /dev/null +++ b/crates/trios-physics/rings/PH-01/README.md @@ -0,0 +1,7 @@ +# PH-01 โ€” physics equations + +Equations on top of PH-00. + +## API +- `rest_energy(mass_kg) -> f64` +- `de_broglie_wavelength(momentum) -> f64` diff --git a/crates/trios-physics/rings/PH-01/RING.md b/crates/trios-physics/rings/PH-01/RING.md new file mode 100644 index 0000000000..e8270c1790 --- /dev/null +++ b/crates/trios-physics/rings/PH-01/RING.md @@ -0,0 +1,11 @@ +# RING โ€” PH-01 + +Physics equations. + +## Dependencies +- PH-00 + +## Laws +- R1: no BR-OUTPUT +- R9: no sibling imports +- L6: pure Rust diff --git a/crates/trios-physics/rings/PH-01/TASK.md b/crates/trios-physics/rings/PH-01/TASK.md new file mode 100644 index 0000000000..263d252038 --- /dev/null +++ b/crates/trios-physics/rings/PH-01/TASK.md @@ -0,0 +1,10 @@ +# TASK โ€” PH-01 + +## Status: SCAFFOLDED +- [x] rest_energy, de_broglie_wavelength +- [x] Tests + +## Open +- [ ] Migrate FFI equations from `src/` +- [ ] Add gravitational potential energy, Schwarzschild radius +- [ ] Add Schroedinger time-independent solver helper diff --git a/crates/trios-physics/rings/PH-01/src/lib.rs b/crates/trios-physics/rings/PH-01/src/lib.rs new file mode 100644 index 0000000000..8e78cf8c78 --- /dev/null +++ b/crates/trios-physics/rings/PH-01/src/lib.rs @@ -0,0 +1,32 @@ +//! PH-01 โ€” physics equations +//! +//! Equations on top of PH-00 constants. + +use trios_physics_ph00::{C, H}; + +/// E = m c^2. +pub fn rest_energy(mass_kg: f64) -> f64 { + mass_kg * C * C +} + +/// de Broglie wavelength: lambda = h / p. +pub fn de_broglie_wavelength(momentum: f64) -> f64 { + H / momentum +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn rest_energy_one_kg() { + let e = rest_energy(1.0); + assert!((e - C * C).abs() < 1e-6); + } + + #[test] + fn de_broglie_unit_momentum() { + let lambda = de_broglie_wavelength(1.0); + assert!((lambda - H).abs() < 1e-40); + } +}