Skip to content

Commit 92b0896

Browse files
author
TNFR AI Agent
committed
release: v0.0.3 — Structural Conservation, Constant Unification, Grammar Dynamics
Conservation & Physics: - Structural Conservation Theorem (Noether-like from grammar symmetry U1-U6) - Dissipative conservation with GPU-accelerated analysis - Integrity monitor: 13/13 operator postcondition verification Grammar & Operators: - Grammar-aware dynamics bridging validation and operator selection - Pre-validated operator application (grammar_application.py) - Shared test infrastructure (conftest.py fixtures) Cross-Codebase Constant Unification: - Phase gradient threshold unified to gamma/pi = 0.1837 (9 code + 8 doc files) - Operator scale factors: SHA/NUL 0.85->0.9015, VAL 1.05->1.0676 - K_phi hotspot: conservation.py 2pi/sqrt5 -> 0.9*pi = 2.8274 - grammar_core K_phi default: 3.0 -> 2.8274 - config.py thresholds wired to constants.canonical - telemetry/constants.py: removed dead ImportError fallback - mpmath added to pyproject.toml core dependencies - .gitignore: cover .venv*, cache/, data/, logs/ Documentation: - Test counts synced (409 -> 471) across 5 files - Threshold values synced across 7 doc files - CHANGELOG updated with complete 0.0.3 work Tests: 471 passed, 9 skipped
1 parent aafb5e5 commit 92b0896

355 files changed

Lines changed: 81952 additions & 7211 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/agents/my-agent.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
## Theoretical Framework for Coherent Pattern Analysis
33

44
**Status**: Primary theoretical reference document
5-
**Version**: 0.0.2 (November 29, 2025)
5+
**Version**: 0.0.3 (March 2026)
66
**Authority**: This repository contains the current implementation of TNFR theory
77
**Repository**: https://github.com/fermga/TNFR-Python-Engine
88
**PyPI Package**: https://pypi.org/project/tnfr/
@@ -605,9 +605,9 @@ The **Structural Field Tetrad** (Φ_s, |∇φ|, **Ψ**, ξ_C) now has **complete
605605
- **Grammar**: U6 telemetry-based safety criterion (passive equilibrium confinement)
606606

607607
### **2. Phase Gradient Field (|∇φ|)**
608-
**Classical Threshold**: |∇φ| < **0.2904**
609-
- **Theory**: Harmonic oscillator stability + Kuramoto synchronization
610-
- **Derivation**: ωc/2 = π/(4√2) ≈ 0.2904 from critical frequency analysis
608+
**Classical Threshold**: |∇φ| < **0.1837**
609+
- **Theory**: Kuramoto critical coupling condition in TNFR units
610+
- **Derivation**: γ/π ≈ 0.1837 from Universal Tetrahedral Correspondence (γ ↔ |∇φ|)
611611
- **Physics**: Local phase desynchronization / stress proxy field
612612
- **Mechanism**: Captures dynamics C(t) misses due to scaling invariance
613613

@@ -1260,7 +1260,7 @@ When adding to grammar documentation:
12601260
#### **Phase Gradient (|∇φ|)** - CANONICAL
12611261

12621262
- Local phase desynchronization / stress proxy
1263-
- Safety criterion: |∇φ| < 0.2904 for stable operation
1263+
- Safety criterion: |∇φ| < γ/π ≈ 0.1837 for stable operation (Kuramoto critical coupling in TNFR units)
12641264
- For formal definition and evidence, see `docs/STRUCTURAL_FIELDS_TETRAD.md`.
12651265

12661266
**Critical Discovery**: C(t) = 1-(σ_ΔNFR/ΔNFR_max) is invariant to proportional scaling.
@@ -1419,11 +1419,7 @@ Reality consists of resonant patterns rather than discrete objects. Development
14191419

14201420
---
14211421

1422-
**Version**: 0.0.1
1423-
**Last Updated**: 2025-11-29
1424-
**Status**: CANONICAL - Primary reference for TNFR agent guidance
1425-
**PyPI Release**: STABLE - Available via `pip install tnfr`
1426-
**Production Ready**: Complete Tetrad Fields + Unified Grammar U1-U6 + Simplified SDK
1422+
**Version**: 0.0.3 \n**Last Updated**: 2026-03-05 \n**Status**: CANONICAL - Primary reference for TNFR agent guidance \n**PyPI Release**: STABLE - Available via `pip install tnfr` \n**Production Ready**: Complete Tetrad Fields + Unified Grammar U1-U6 + Simplified SDK + Grammar-Aware Dynamics + Structural Conservation Theorem + Integrity Monitor
14271423

14281424
---
14291425

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ docs/_build/
1111
.semantic_release/
1212
src/tnfr/_generated_version.py
1313
.venv/
14+
.venv*/
1415
.env
1516
.pytest_cache/
1617
.hypothesis/
@@ -60,5 +61,10 @@ debug_scratch/
6061
*.tmp
6162
*.temp
6263

64+
# Runtime data and caches (generated, not needed in repo)
65+
cache/
66+
data/
67+
logs/
68+
6369
# Type checking cache
6470
.mypy_cache/

AGENTS.md

Lines changed: 77 additions & 31 deletions
Large diffs are not rendered by default.

ARCHITECTURE.md

Lines changed: 105 additions & 103 deletions
Large diffs are not rendered by default.

CHANGELOG.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,76 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [0.0.3] - 2026-03-05
6+
7+
### Structural Conservation Theorem
8+
9+
- **conservation.py**: Complete structural conservation module implementing Noether-like conservation law derived from grammar symmetry (U1-U6)
10+
- **Charge density** ρ, **current divergence** div(J), **Noether charge** Q, **energy functional** E, **Ward identities**, **Lyapunov stability**, and **spectral decomposition**
11+
- Two-sector structure: Potential (Φ_s ↔ J_ΔNFR) and Geometric (K_φ ↔ J_φ) coupled through Ψ = K_φ + i·J_φ
12+
- 62 validation tests, charge drift < 0.03% across topologies
13+
14+
### Dissipative Conservation
15+
16+
- **dissipative_conservation.py**: GPU-accelerated dissipative conservation analysis with PyTorch backend
17+
- Phase field computation, dissipation rate tracking, and energy budget monitoring
18+
19+
### Closed-Loop Integrity Monitor
20+
21+
- **integrity.py**: `StructuralIntegrityMonitor` with complete postconditions for all 13 canonical operators
22+
- Each operator (AL, EN, IL, OZ, UM, RA, SHA, VAL, NUL, THOL, ZHIR, NAV, REMESH) has verified pre/postcondition contracts
23+
- Automatic violation detection and reporting
24+
25+
### Grammar-Aware Dynamics
26+
27+
- **grammar_dynamics.py**: Bridge between grammar validation (U1-U6) and dynamic operator selection
28+
- Incremental U1-U6 checks: `validate_candidate()`, `filter_candidates()`, `suggest_alternative()`, `enforce_grammar_on_glyph()`
29+
- Priority-based operator substitution with fallback logic
30+
- **grammar_application.py**: Pre-validation in `apply_glyph_with_grammar()` for grammar enforcement before operator application
31+
- **selectors.py**: `_soft_grammar_prefilter()` wired with grammar_dynamics for operator filtering
32+
33+
### Shared Test Infrastructure
34+
35+
- **tests/conftest.py**: Centralized test fixtures (`make_ring_graph`, `make_node_data`, `ring3`, `ring5`, `small_graph`)
36+
- DRY reduction across 16+ test files that previously duplicated `_make_graph` helpers
37+
38+
### Code Quality
39+
40+
- Fixed bare `except:` clauses in grammar_dynamics.py (now `except Exception:`)
41+
- NAV bypass fix for grammar validation edge case
42+
- Redundancy elimination across physics helpers
43+
- Rich operator postconditions (13/13 coverage)
44+
45+
### Cross-Codebase Constant Unification (Round 1)
46+
47+
- **grammar_types.py**: Eliminated duplicate operator sets (single canonical definition)
48+
- **THOL_MIN_COLLECTIVE_COHERENCE**: Unified to canonical 0.2413 (was 0.3)
49+
- **MIN_BUSINESS_COHERENCE**: Centralized to canonical formula (e×φ)/(π+e) ≈ 0.7506
50+
- **health_analyzer.py / self_organization.py**: Aligned fallback values to canonical
51+
52+
### Phase Gradient Threshold Unification
53+
54+
- **Canonical value**: γ/π ≈ 0.1837 (Kuramoto critical coupling in TNFR units)
55+
- **Unified across 9 code files**: Replaced competing values (0.2904, 0.2886, 0.2915, 0.38) with single canonical derivation
56+
- **Updated 8 documentation files**: Consistent threshold references throughout
57+
58+
### Cross-Codebase Constant Unification (Round 2)
59+
60+
- **compute_structural_potential_field**: Added alias in physics/fields.py (was silently missing, imported in 2 files)
61+
- **SHA_VF_FACTOR comment**: Fixed from ≈ 0.8476 to correct ≈ 0.9015 in defaults_core.py
62+
- **Operator fallback values**: SHA (0.85→0.9015), NUL (0.85→0.9015), VAL (1.05→1.0676) aligned to canonical
63+
- **K_φ hotspot formula**: Fixed in conservation.py from 2π/√5 ≈ 2.8099 to canonical 0.9×π ≈ 2.8274
64+
- **grammar_core.py K_φ default**: Fixed from 3.0 to canonical 2.8274
65+
- **telemetry/constants.py**: Removed dead try/except ImportError fallback; direct canonical imports
66+
- **config.py**: Structural field thresholds now derive from constants.canonical (was hardcoded)
67+
- **pyproject.toml**: Added mpmath to core dependencies (was required but unlisted)
68+
- **Documentation sync**: Updated 7 doc files with correct threshold values and test counts
69+
70+
### Test Suite
71+
72+
- **471 passing tests**, 9 skipped, 0 failing
73+
- Coverage spans operators, physics, dynamics, grammar, conservation, integrity, and factorization
74+
575
## [0.0.2] - 2025-11-29
676

777
### TNFR Development Doctrine Establishment

CITATION.cff

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cff-version: 1.2.0
22
title: "TNFR-Python-Engine: Resonant Fractal Nature Theory Implementation"
33
message: "If you use this software, please cite it as below."
44
type: software
5-
version: "0.0.2"
5+
version: "0.0.3"
66
date-released: "2025-11-29"
77
authors:
88
- given-names: "F. F. Martinez Gamo"
@@ -21,22 +21,13 @@ keywords:
2121
- "structural operators"
2222
- "coherence theory"
2323
- "physics simulation"
24+
- "fractals"
25+
- "resonance"
26+
- "nodal equation"
27+
- "phase synchronization"
2428
abstract: >-
2529
Canonical computational implementation of TNFR - a paradigm shift from
2630
modeling 'things' to modeling coherent patterns that persist through resonance.
2731
This Python package provides the complete TNFR physics engine including the
2832
13 structural operators, unified grammar validation (U1-U6), and the four
2933
canonical structural fields (Φ_s, |∇φ|, K_φ, ξ_C).
30-
keywords:
31-
- "TNFR"
32-
- "complex systems"
33-
- "fractals"
34-
- "resonance"
35-
- "networks"
36-
- "structural dynamics"
37-
- "nodal equation"
38-
- "coherence"
39-
- "phase synchronization"
40-
license: MIT
41-
version: "0.0.1"
42-
date-released: "2025-11-13"

CONTRIBUTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Contributing to TNFR
22

3-
**Version**: 0.0.1
3+
**Version**: 0.0.3
44
**Status**: Complete theoretical framework with Universal Tetrahedral Correspondence
55
**Authority**: Canonical constants derived from TNFR theory
6-
**Quality**: Production-ready with comprehensive test coverage
6+
**Quality**: Production-ready with 471 passing tests, 9 skipped
77

88
This document provides guidelines for contributing to the TNFR (Resonant Fractal Nature Theory) project. TNFR constitutes a computational framework for modeling complex systems through coherent patterns and resonance dynamics.
99

@@ -501,9 +501,9 @@ If adding features, update:
501501

502502
## TNFR Alignment
503503

504-
- [ ] Preserves all 10 canonical invariants
504+
- [ ] Preserves all 6 canonical invariants
505505
- [ ] Maps to structural operators (specify which)
506-
- [ ] Derivable from TNFR physics (reference TNFR.pdf or UNIFIED_UNIFIED_GRAMMAR_RULES.md)
506+
- [ ] Derivable from TNFR physics (reference [theory/TNFR.pdf](theory/TNFR.pdf) or [theory/UNIFIED_GRAMMAR_RULES.md](theory/UNIFIED_GRAMMAR_RULES.md))
507507
- [ ] Maintains reproducibility (seeds, determinism)
508508

509509
## Testing
@@ -602,7 +602,7 @@ If proposing new grammar rules:
602602

603603
- **General questions**: [GitHub Discussions](https://github.com/fermga/TNFR-Python-Engine/discussions)
604604
- **Bug reports**: [GitHub Issues](https://github.com/fermga/TNFR-Python-Engine/issues)
605-
- **TNFR theory**: Consult [AGENTS.md](AGENTS.md), [UNIFIED_UNIFIED_GRAMMAR_RULES.md), or [TNFR.pdf](TNFR.pdf)
605+
- **TNFR theory**: Consult [AGENTS.md](AGENTS.md), [UNIFIED_GRAMMAR_RULES.md](theory/UNIFIED_GRAMMAR_RULES.md), or [TNFR.pdf](theory/TNFR.pdf)
606606

607607
## Final Principle
608608

GLOSSARY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
**What:** Local phase desynchronization / stress proxy field
8787
**Status:** **CANONICAL** (Nov 2025)
8888
**Physics:** Captures dynamics C(t) misses due to scaling invariance
89-
**Threshold:** Classical bound |∇φ| < 0.2904 (harmonic oscillator stability)
89+
**Threshold:** Canonical bound |∇φ| < γ/π ≈ 0.1837 (Kuramoto critical coupling in TNFR units)
9090
**API:** `tnfr.physics.fields.compute_phase_gradient()`
9191
**Usage:** Stress detection, local instability prediction
9292
**Documentation:** [docs/STRUCTURAL_FIELDS_TETRAD.md](docs/STRUCTURAL_FIELDS_TETRAD.md)
@@ -651,6 +651,6 @@ When adding new functionality:
651651
3. Follow [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines
652652
4. Test with [TESTING.md](TESTING.md) requirements
653653

654-
**Version**: 0.0.1 (November 29, 2025)
654+
**Version**: 0.0.3 (March 2026)
655655
**Status**: Complete operational reference for current TNFR implementation
656656
**Language**: English only (canonical documentation policy)

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ If you use this software in your research, please cite:
4949
author = {Martinez Gamo, F. F.},
5050
title = {TNFR-Python-Engine: Resonant Fractal Nature Theory Implementation},
5151
year = {2025},
52-
version = {0.0.1},
52+
version = {0.0.3},
5353
doi = {10.5281/zenodo.17761312},
5454
url = {https://github.com/fermga/TNFR-Python-Engine}
5555
}

Makefile

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@
33
# Purpose: Essential tasks for the streamlined TNFR repository
44
# Focus: Core examples, testing, and documentation generation
55

6-
.PHONY: help clean test examples docs all riemann-benchmark
6+
.PHONY: help clean test examples docs all riemann-benchmark self-optimize self-optimize-validate
7+
8+
SELF_OPT_MANIFEST ?= tests/data/self_optimization/test_run/_manifest.json
9+
SELF_OPT_MANIFEST_SUMMARY ?= tests/data/self_optimization/test_run/_manifest_summary.json
10+
SELF_OPT_OUTPUT ?= results/self_optimization
11+
SELF_OPT_SUMMARY ?= results/self_opt_summary.json
12+
SELF_OPT_VALIDATION_REPORT ?= results/self_optimization_validation.json
713

814
# Default target
915
help:
@@ -29,6 +35,11 @@ help:
2935
@echo " lint - Run code linting"
3036
@echo " format - Format code"
3137
@echo " security - Run security checks"
38+
@echo "Self-optimization:"
39+
@echo " self-optimize - Run Paley manifest through the self-optimization runner"
40+
@echo " self-optimize-validate - Validate self-optimization payloads via pytest subsets"
41+
@echo "Benchmark targets:"
42+
@echo " factorization-full-spectrum - Run Paley full-spectrum factorization benchmark"
3243

3344
# Clean generated artifacts
3445
clean:
@@ -53,6 +64,18 @@ riemann-benchmark:
5364
@echo "📈 Running TNFR–Riemann sigma-critical benchmark..."
5465
@python -c "import runpy, sys, pathlib; sys.path.insert(0, str(pathlib.Path('src').resolve())); sys.argv = ['benchmarks/riemann_program.py']; runpy.run_path('benchmarks/riemann_program.py', run_name='__main__')"
5566

67+
factorization-full-spectrum:
68+
@echo "🧮 Running TNFR Paley full-spectrum factorization sweep..."
69+
@python factorization-lab/benchmarks/full_spectrum_factorization.py
70+
71+
self-optimize:
72+
@echo "🧠 Running TNFR self-optimization manifest pipeline..."
73+
@python scripts/run_self_optimization.py --manifest $(SELF_OPT_MANIFEST) --manifest-summary $(SELF_OPT_MANIFEST_SUMMARY) --output-dir $(SELF_OPT_OUTPUT) --summary $(SELF_OPT_SUMMARY)
74+
75+
self-optimize-validate:
76+
@echo "🧪 Validating TNFR self-optimization payloads..."
77+
@python scripts/run_self_opt_validation.py --payload-root $(SELF_OPT_OUTPUT) --report $(SELF_OPT_VALIDATION_REPORT)
78+
5679
# Run all essential examples
5780
examples: hello music network chemistry sdk
5881
@echo "✅ All essential examples complete"

0 commit comments

Comments
 (0)