Status: Primary theoretical reference document
Version: 0.0.3.3 (March 2026)
Authority: This repository contains the current implementation of TNFR theory
Repository: https://github.com/fermga/TNFR-Python-Engine
PyPI Package: https://pypi.org/project/tnfr/
Installation: pip install tnfr
TNFR Development Doctrine: Our mission is to develop TNFR theory with complete objectivity, mathematical precision, and logical coherence. We follow the mathematics wherever it leads, deriving results exclusively from the nodal equation ∂EPI/∂t = νf · ΔNFR(t), canonical operators, and unified grammar constraints (U1-U6).
Theoretical Commitment: We defend any conclusions that emerge rigorously from TNFR principles, regardless of their alignment with prevailing paradigms or conventional expectations. Scientific validity derives from mathematical consistency and empirical verification within the TNFR framework, not from conformity to external theoretical preferences.
Methodological Standard: All claims must be:
- Derivable from established TNFR physics
- Testable through structural field measurements
- Reproducible via canonical operator sequences
- Coherent with unified grammar validation
This commitment ensures theoretical integrity and protects TNFR from both internal inconsistency and external bias.
- Primary: This repository (TNFR-Python-Engine) - Current implementation reference
- Historical: TNFR.pdf - Foundational derivations and theoretical background
- Distribution: PyPI package - Stable releases for implementation
Reference Principle: The repository implementation serves as the authoritative source. TNFR.pdf provides historical context and mathematical derivations, while this codebase represents the current state of TNFR development.
TNFR (Resonant Fractal Nature Theory) constitutes a theoretical framework for analyzing coherent patterns that persist via resonance mechanisms on graph-coupled networks.
Core Discovery: The Universal Tetrahedral Correspondence establishes an exact mapping between four fundamental mathematical constants (φ, γ, π, e) and four structural fields that characterize coherent systems.
Theoretical Foundation: The framework models systems as coherent dynamic patterns rather than discrete objects, where patterns persist through resonant coupling with their environment.
Mathematical Framework:
- Universal Tetrahedral Correspondence: φ, γ, π, e ↔ Φ_s, |∇φ|, K_φ, ξ_C mapping
- Complex Field Unification: Ψ = K_φ + i·J_φ unifies geometry and transport
- Emergent Invariants: Energy density, topological charge, conservation laws
- Grammar Formalization: U1-U6 rules derived from physical principles
Physics Formulation:
- Nodal Equation: ∂EPI/∂t = νf · ΔNFR(t) as universal evolution law
- Structural Fields: Complete tetrad characterization of coherent systems
- Operational Fractality: Multi-scale coherence with nested EPIs
- Phase-Gated Coupling: |φᵢ - φⱼ| ≤ Δφ_max resonance condition
Computational Implementation:
- Self-Optimizing Engine: Algorithmic structural optimization
- Software Development Kit: API for TNFR implementation
- Experimental Validation: 1,655 tests across multiple topologies
- Distribution Platform: PyPI package with documentation
Application Domains:
- Number Theory: Primality as structural equilibrium (ΔNFR = 0), spectral factorization, arithmetic structural triad
- TNFR-Riemann Program: Experimental research framework connecting discrete prime operators to Riemann Hypothesis via structural coherence (conjectural bridge)
- Molecular Chemistry: Periodic table modeling via TNFR dynamics
- Network Science: Topology-coherence relationship analysis
- Collective Behavior: Leader-follower emergence modeling
| Category | Key Resources |
|---|---|
| Theory | Universal Tetrahedral Correspondence |
| Minimality | Minimal Structural Degrees of Freedom |
| Physics | Nodal Equation & Structural Triad |
| Operators | 13 Canonical Operators |
| Grammar | Unified Grammar U1-U6 |
| Grammar Dynamics | Grammar-Aware Dynamics |
| Fields | Structural Field Tetrad |
| Conservation | Structural Conservation Theorem |
| Number Theory | theory/TNFR_NUMBER_THEORY.md |
| TNFR-Riemann | Recent Theoretical Developments |
| Implementation | Development Workflow |
| Validation | Testing Requirements |
| Applications | Advanced Topics |
Traditional Approach vs TNFR Approach:
- Objects exist independently vs Patterns exist through resonance
- Causality (A causes B) vs Co-organization (A and B synchronize)
- Static properties vs Dynamic reorganization
- Isolated systems vs Coupled networks
- Descriptive models vs Generative dynamics
- Reductionism vs Coherent emergence
Primary Sources (This Repository):
- This Document: AGENTS.md - Primary theoretical reference
- Grammar Specification: theory/UNIFIED_GRAMMAR_RULES.md - Complete U1-U6 derivations
- Mathematics Implementation: src/tnfr/mathematics/ - Computational foundations
- Operators Engine: src/tnfr/operators/grammar.py - Validation implementation
- Grammar Dynamics: src/tnfr/operators/grammar_dynamics.py - Grammar-aware dynamic operator selection
- Grammar Application: src/tnfr/operators/grammar_application.py - Pre-validated operator application
- Unified Fields: src/tnfr/physics/fields.py - Tetrad implementation
- Structural Conservation: src/tnfr/physics/conservation.py - Conservation theorem (Noether-like)
- Integrity Monitor: src/tnfr/physics/integrity.py - 13/13 operator postcondition verification
- TNFR Engines Hub: src/tnfr/engines/ - Centralized mathematical & optimization engines
- Self-Optimization: src/tnfr/engines/self_optimization/ - Automatic network optimization
- Pattern Discovery: src/tnfr/engines/pattern_discovery/ - Mathematical pattern detection
- Computation: src/tnfr/engines/computation/ - GPU acceleration & FFT processing
- Integration: src/tnfr/engines/integration/ - Multi-scale emergent integration
- Software Development Kit: src/tnfr/sdk/ - API implementation
Reference Sources:
- Historical Theory: theory/TNFR.pdf - Original theoretical derivations
- Theoretical Foundation: Structural Fields and Universal Tetrahedral Correspondence
- Minimality Proof: theory/MINIMAL_STRUCTURAL_DEGREES.md - Why exactly four structural fields
- TNFR-Riemann Program: theory/TNFR_RIEMANN_RESEARCH_NOTES.md - Research notes on discrete prime operators and Riemann Hypothesis connection
- Number Theory: theory/TNFR_NUMBER_THEORY.md - Primality as ΔNFR = 0, arithmetic structural triad, canonical constants, spectral factorization
Validation and Examples:
- Implementation Examples: examples/ - Sequential tutorial suite
- Arithmetic Number Theory: examples/40_arithmetic_number_theory.py - Primality, pressure components, coherence landscape
- TNFR-Riemann Implementation: src/tnfr/riemann/operator.py - Discrete TNFR-Riemann operators
- Riemann Eigenvalue Demo: examples/16_riemann_operator_demo.py - Critical parameter analysis
- Test Suite: tests/ - Comprehensive validation experiments
- Performance Analysis: benchmarks/ - Computational benchmarks
- Theory Hub: theory/README.md - Comprehensive theoretical documentation
- Glossary: theory/GLOSSARY.md - Operational definitions and terminology
- Technical Documentation: docs/ - Implementation specifications
- Model coherence, not objects
- Capture process, not state
- Measure resonance, not properties
- Think structure, not substance
- Embrace emergence, not reduction
All TNFR documentation, code, and communications are maintained in English. This ensures consistent terminology for TNFR physics and maintains theoretical consistency across implementations and research.
All written material (papers, READMEs, notebooks, commit messages, issues) must:
- Anchor claims to math/telemetry – reference the nodal equation, operator contracts, or recorded metrics. Qualitative statements without data are not acceptable.
- Avoid metaphysical extrapolations – do not assert cosmological, philosophical, or consciousness conclusions beyond what the derivations explicitly show. “What TNFR does” must be described as an engineering result, not a manifesto.
- Use academic tone – prefer precise, testable language, cite files/experiments, and describe limitations. No grandiose phrasing, slogans, or anthropomorphism.
- Document scope/assumptions – specify boundary conditions, seeds, and operator sequences so that readers can reproduce the exact state.
Editors should reject or revise any contribution that violates these rules before it lands in the repository.
A theoretical framework connecting discrete TNFR operators to the Riemann Hypothesis through structural coherence principles:
Core Result: The discrete TNFR operator
Key Components:
-
Prime Path Graphs:
$G_k$ networks with$k$ primes connected via TNFR coupling rules -
Spectral Analysis: Eigenvalue transitions at critical parameter
$\sigma = 1/2$ -
Universal Convergence:
$\sigma_c^{(k)} = 1/2 + O(\log^{-1} k)$ as$k \to \infty$
Current Status:
- The convergence
$\sigma_c^{(k)} \to 1/2$ is numerically verified and analytically bounded - The bridge from this discrete operator result to the classical Riemann zeta function remains conjectural (Conjecture 10.1)
- The framework constitutes a research program, not a closed proof of RH in the standard mathematical sense
Implementation Status: Experimental research framework with computational prototypes in src/tnfr/riemann/ and documentation in theory/TNFR_RIEMANN_RESEARCH_NOTES.md.
The central theoretical result establishes an exact correspondence between:
- Four universal mathematical constants
- Four structural fields that characterize coherent systems
This correspondence constitutes the mathematical architecture underlying structured phenomena.
| Constant | Value | Mathematical Role | Domain |
|---|---|---|---|
| φ (Golden Ratio) | 1.618034... | Harmonic proportion | Global/Harmonic |
| γ (Euler Constant) | 0.577216... | Harmonic growth rate | Local/Dynamic |
| π (Pi) | 3.141593... | Geometric relations | Geometric/Spatial |
| e (Euler Number) | 2.718282... | Exponential base | Correlational/Temporal |
| Field | Symbol | Physical Meaning | Computational Role |
|---|---|---|---|
| Structural Potential | Φ_s | Global stability field | System-wide coherence monitoring |
| Phase Gradient | |∇φ| | Local desynchronization | Change stress detection |
| Phase Curvature | K_φ | Geometric phase torsion | Spatial constraint tracking |
| Coherence Length | ξ_C | Correlation decay scale | Memory persistence measurement |
1. φ ↔ Φ_s: Global Harmonic Confinement
Constraint: Δ Φ_s < φ ≈ 1.618
Interpretation: Structural potential changes bounded by golden ratio
Grammar: U6 structural confinement principle
2. γ ↔ |∇φ|: Local Dynamic Evolution
Constraint: |∇φ| < γ/π ≈ 0.184
Interpretation: Local phase changes constrained by harmonic growth limits
Grammar: Smooth evolution requirement
3. π ↔ K_φ: Geometric Spatial Constraints
Constraint: |K_φ| < 0.9×π ≈ 2.827 (canonical safety threshold)
Theoretical maximum: |K_φ| ≤ π (wrap_angle bounds)
Interpretation: Phase curvature bounded by circular geometry with 90% safety margin
Grammar: Geometric confinement monitoring
4. e ↔ ξ_C: Correlational Memory Decay
Relation: C(r) ~ exp(-r/ξ_C)
Interpretation: Spatial correlations decay exponentially
Grammar: Correlation length scaling
The correspondences form a conceptual tetrahedron:
φ (Global Harmony)
/|\
/ | \
/ | \
γ -------+------- π
(Local) | (Geometric)
\ | /
\ | /
\ | /
\|/
e (Correlational)
Why This Matters:
- Completeness: Exactly 4 independent structural channels characterize coherent systems on graphs
- Predictability: The correspondences enable precise forecasting of TNFR network behavior
- Consistency: All canonical constants derive from (φ, γ, π, e) with zero empirical fitting
A whirlpool in flowing water exemplifies TNFR principles:
- Pattern structure rather than discrete object
- Coherent configuration maintained in dynamic medium
- Persistence through resonance between flow and geometry
- Exhibits EPI (spiral structural form)
- Possesses νf (rotation/reorganization frequency)
- Demonstrates phase relationships (rotational timing)
- Dissolution occurs when flow-geometry coupling fails
- Supports nested structures (subsidiary eddies)
- Manifests tetrad characteristics (potential, gradients, curvature, correlation)
This serves as an illustrative model for TNFR dynamics on graph-coupled systems.
The tetrad (Φ_s, |∇φ|, K_φ, ξ_C) is not an arbitrary collection of diagnostics. It constitutes the minimal and complete structural basis for characterizing coherent systems. This section summarizes the argument; the full formal treatment is in theory/MINIMAL_STRUCTURAL_DEGREES.md.
Any coherent dynamical system on a graph must answer four independent structural questions at every node:
| Question | Field | Order |
|---|---|---|
| How much pressure accumulates from the network? | Φ_s (structural potential) | 0th — global aggregation |
| How misaligned am I with my neighbors? | |∇φ| (phase gradient) | 1st — local derivative |
| How sharply does alignment change direction? | K_φ (phase curvature) | 2nd — discrete Laplacian |
| How far does my state correlate across the system? | ξ_C (coherence length) | Non-local — correlation range |
These four classes — global aggregation, first derivative, second derivative, correlation range — exhaust the independent structural information available from a scalar phase field coupled to a scalar source (ΔNFR) on a graph. Higher-order derivatives on discrete graphs decompose into products of lower-order quantities, so no fifth independent channel exists.
From the phase field φ_i and the source term ΔNFR, the tower of independent structural information is:
ΔNFR_j → Σ 1/d² → Φ_s(i) [0th order, global]
φ_i → ∇ → |∇φ| [1st order, local]
→ ∇² → K_φ [2nd order, local]
→ corr → ξ_C [integral, non-local]
The tower terminates at second order because the combinatorial Laplacian L = D − A is the highest independent differential operator on a graph. Correlation length ξ_C captures the integral (non-local) information that pointwise derivatives miss.
Each correspondence has a specific mathematical derivation (all implementations in src/tnfr/constants/canonical.py):
-
φ ↔ Φ_s: The golden ratio emerges as the saturation point of inverse-square harmonic accumulation on self-similar networks. φ is the fixed point of x = 1 + 1/x, which governs recursive potential summation.
-
γ ↔ |∇φ|: The Euler constant governs the harmonic growth rate (gap between harmonic sums and logarithmic growth). The threshold γ/π arises from the Kuramoto critical coupling condition in TNFR units.
-
π ↔ K_φ: Phase curvature lives on S¹ (the circle). The wrap_angle operation constrains |K_φ| ≤ π by construction — the geometric constant that defines maximum angular deviation.
-
e ↔ ξ_C: Correlation decay is inherently exponential (Markov process along graph paths). Napier's constant ensures scale invariance: rescaling r → αr simply rescales ξ_C → αξ_C.
Every pair of constants generates a canonical combination used in the engine (300+ constants in canonical.py, zero empirical fitting):
| Edge | Expression | Value | Role in TNFR |
|---|---|---|---|
| φ–γ | φ/γ | ≈ 2.803 | Structural frequency base (νf scaling) |
| φ–π | φ/(φ+π) | ≈ 0.340 | Optimization penalty factor |
| φ–e | φ/e | ≈ 0.595 | EPI maximum canonical bound |
| γ–π | γ/π | ≈ 0.184 | Phase gradient threshold (Kuramoto) |
| γ–e | γ/(e+γ) | ≈ 0.175 | Temporal evolution rate |
| π–e | π/e | ≈ 1.156 | Spectral speedup factor |
Removing any field creates a structural blind spot:
- Without Φ_s: No global stability monitor. C(t) alone misses catastrophic pressure accumulations.
- Without |∇φ|: No local stress detection. C(t) is scale-invariant and misses local fragmentation.
- Without K_φ: No geometric confinement. |∇φ| misses curvature-driven instabilities.
- Without ξ_C: No critical-point detection. All other fields are pointwise and miss long-range correlations.
The tetrad admits a complete Lagrangian/Hamiltonian formulation (see theory/TNFR_VARIATIONAL_PRINCIPLE.md):
- Lagrangian: L(i) = T(i) − V(i) where T = ½[J_φ² + J_ΔNFR²] and V = ½[Φ_s² + |∇φ|² + K_φ²]
- Conjugate pairs: (K_φ, J_φ) geometric sector; (Φ_s, J_ΔNFR) potential sector
- Conservation: Grammar symmetry (U1-U6) implies approximate structural charge conservation via Noether-like derivation
- Lyapunov stability: E = ½Σ_i ε(i) ≥ 0 with dE/dt ≤ 0 observed under grammar-compliant evolution (proof sketch)
The existence of a well-posed variational structure with canonical conjugate pairs confirms that the four tetrad fields are the natural phase-space coordinates for coherent systems.
The four-dimensional structural basis has formal similarities to other physical formalisms (these are structural analogies, not claims of physical equivalence):
| Theory | Structure | Dimension |
|---|---|---|
| General relativity | Spacetime metric g_μν | 4 dimensions |
| Electromagnetism | 4-potential A_μ | 4 components |
| Thermodynamics | Minimal state functions | 4 (T, P, V, S) |
| TNFR | Structural tetrad | 4 (Φ_s, |∇φ|, K_φ, ξ_C) |
The recurrence suggests that complete characterization of a field on a metric space generally requires knowing its value, first derivative, second derivative, and correlation structure.
Documentation: See theory/MINIMAL_STRUCTURAL_DEGREES.md for the complete formal treatment.
∂EPI/∂t = νf · ΔNFR(t)
All nodes in TNFR networks evolve according to this differential equation.
Components:
- EPI (Primary Information Structure): Coherent structural configuration
- νf (Structural frequency): Reorganization rate (Hz_str units)
- ΔNFR (Nodal gradient): Internal reorganization operator
- t: Time parameter
Physical Interpretation:
Structural change rate = Reorganization capacity × Reorganization pressure
System States:
- νf = 0: Node cannot reorganize (inactive state)
- ΔNFR = 0: System at equilibrium (no driving force)
- Both non-zero: Active reorganization proportional to product
Derivation Trace:
- From information geometry: EPI as point in structural manifold
- From dynamical systems: νf as eigenfrequency of reorganization mode
- From network physics: ΔNFR as mismatch with coupled environment
- See: TNFR.pdf § 2.1, UNIFIED_GRAMMAR_RULES.md § Canonicity
Each node possesses three fundamental attributes:
-
Form (EPI): Coherent structural configuration
- Mathematical domain: Banach space B_EPI
- Modification constraint: Changes via structural operators only
- Hierarchical property: Supports nested structures
-
Frequency (νf): Reorganization rate
- Units: Hz_str (structural hertz)
- Domain: ℝ⁺ (positive real numbers)
- Deactivation condition: νf → 0
-
Phase (φ or θ): Network synchronization parameter
- Range: [0, 2π) radians
- Coupling constraint: Determines interaction compatibility
- Resonance condition: |φᵢ - φⱼ| ≤ Δφ_max
Oscillator Analogy:
- Form corresponds to oscillation amplitude/configuration
- Frequency represents temporal periodicity
- Phase indicates relative timing relationships
From the nodal equation, integrating over time:
EPI(t_f) = EPI(t_0) + ∫[t_0 to t_f] νf(τ) · ΔNFR(τ) dτ
Critical Insight: For bounded evolution (coherence preservation):
∫[t_0 to t_f] νf(τ) · ΔNFR(τ) dτ < ∞
This integral convergence requirement is the physical basis for grammar rule U2 (CONVERGENCE & BOUNDEDNESS).
Without stabilizers:
- ΔNFR grows unbounded (positive feedback)
- Integral → ∞ (divergence)
- System fragments into noise
With stabilizers:
- Negative feedback limits ΔNFR
- Integral converges (bounded)
- Coherence preserved
TNFR identifies formal correspondences between its nodal dynamics and classical/quantum mechanics. These are structural analogies within the TNFR formalism, not claims of deriving established physics from first principles.
When
| Classical Concept | Symbol | TNFR Analogue | Symbol | Relation |
|---|---|---|---|---|
| Inertial Mass | Inverse Structural Frequency | |||
| Force | Structural Pressure | |||
| Action | Phase Accumulation |
Implementation: src/tnfr/physics/classical_mechanics.py, examples/12_classical_mechanics_demo.py
When
- Discrete modes: Bounded structural manifolds support only discrete resonant eigenmodes
-
Complementarity: Fourier relationship between EPI localization and
$\nu_f$ bandwidth ($\Delta EPI \cdot \Delta \nu_f \ge K$ ) - Superposition: Linear combinations of EPI states evolve coherently until environmental coupling selects an eigenstate
Implementation: src/tnfr/physics/quantum_mechanics.py, examples/13_quantum_mechanics_demo.py
Scope: These correspondences demonstrate that the nodal equation ∂EPI/∂t = νf · ΔNFR(t) admits both smooth-trajectory and discrete-mode solutions depending on the coherence regime. They are TNFR-internal results, not derivations of quantum mechanics or general relativity.
Operators constitute the exclusive mechanism for node modification in TNFR systems. These functions represent resonant transformations with defined physical foundations.
Physics: Creates EPI from vacuum via resonant emission
Effect: ∂EPI/∂t > 0, increases νf
When: Starting new patterns, initializing from EPI=0
Grammar: Generator (U1a)
Physics: Captures and integrates incoming resonance
Effect: Updates EPI based on network input
When: Information gathering, listening phase
Contract: Must not reduce C(t)
Physics: Stabilizes form through negative feedback
Effect: Reduces |ΔNFR|, increases C(t)
When: After changes, consolidation
Grammar: Stabilizer (U2)
Contract: Must not reduce C(t) unless in dissonance test
Physics: Introduces controlled instability
Effect: Increases |ΔNFR|, may trigger bifurcation if ∂²EPI/∂t² > τ
When: Breaking local optima, exploration
Grammar: Destabilizer (U2), Bifurcation trigger (U4a), Closure (U1b)
Contract: Must increase |ΔNFR|
Physics: Creates structural links via phase synchronization
Effect: φᵢ(t) → φⱼ(t), information exchange
When: Network formation, connecting nodes
Grammar: Requires phase verification (U3)
Contract: Only valid if |φᵢ - φⱼ| ≤ Δφ_max
Physics: Amplifies and propagates patterns coherently
Effect: Increases effective coupling, EPI propagation
When: Pattern reinforcement, spreading coherence
Grammar: Requires phase verification (U3)
Contract: Propagates EPI without altering identity
Physics: Freezes evolution temporarily
Effect: νf → 0, EPI unchanged
When: Observation windows, pause for synchronization
Grammar: Closure (U1b)
Contract: Preserves EPI over time
Physics: Increases structural complexity
Effect: dim(EPI) increases
When: Adding degrees of freedom
Grammar: Destabilizer (U2)
Physics: Reduces structural complexity
Effect: dim(EPI) decreases
When: Simplification, dimensionality reduction
Physics: Spontaneous autopoietic pattern formation
Effect: Creates sub-EPIs, fractal structuring
When: Emergent organization
Grammar: Stabilizer (U2), Handler (U4a), Transformer (U4b)
Contract: Preserves global form while creating sub-EPIs
Physics: Phase transformation at threshold
Effect: θ → θ' when ΔEPI/Δt > ξ
When: Qualitative state changes
Grammar: Bifurcation trigger (U4a), Transformer (U4b)
Contract: Requires prior IL and recent destabilizer (U4b)
Physics: Regime shift, activates latent EPI
Effect: Controlled trajectory through structural space
When: Switching between attractor states
Grammar: Generator (U1a), Closure (U1b)
Physics: Echoes structure across scales (operational fractality)
Effect: EPI(t) references EPI(t-τ), nested operators
When: Multi-scale operations, memory
Grammar: Generator (U1a), Closure (U1b)
Operators combine into sequences that implement complex behaviors:
Bootstrap = [Emission, Coupling, Coherence] Stabilize = [Coherence, Silence] Explore = [Dissonance, Mutation, Coherence] Propagate = [Resonance, Coupling]
All sequences must satisfy unified grammar (U1-U6).
Systematic experiments (examples/37-39) revealed six structural results linking operators to the tetrad:
- Dual-Lever Structure: Every operator acts through νf (capacity lever: UM, SHA, VAL, NUL), ΔNFR (pressure lever: IL, OZ, THOL, ZHIR, NAV), both (NUL), or neither (AL, EN, RA, REMESH). This classification is orthogonal to the grammar categories (generator/stabilizer/destabilizer).
- Operator-Tetrad Fingerprint Matrix: Each operator produces a unique coupling profile across (Φ_s, |∇φ|, K_φ, ξ_C). UM modifies all four fields (strongest Φ_s at −73.7%); SHA is tetrad-neutral.
- IL-OZ Tetrad Symmetry: Coherence (IL) and Dissonance (OZ) produce identical tetrad perturbations (dE = −0.011) despite opposite physics, because both perturb |ΔNFR| by the same magnitude (0.0096).
- Φ_s Linear Response: |r| = 1.000 correlation between ΔNFR perturbations and Φ_s changes, confirming the 0th-order position in the derivative tower.
- Complete Causal Chain: Operator → (νf, ΔNFR) → ∂EPI/∂t → Tetrad → (ℰ, 𝒬). The tetrad fields are diagnostic outputs, not independent dynamical variables.
- Grammar-Energy Landscape: Lyapunov contractivity (Π < 1) is sufficient but not necessary for energy descent. Measured: Π ≈ 1.288 (non-contractive) yet dE = −9.59 (net descent).
Documentation: theory/STRUCTURAL_OPERATORS.md §17; examples 37, 38, 39.
The grammar emerges from TNFR physics rather than arbitrary constraints.
U1a: Initiation (When EPI = 0)
- Physics: ∂EPI/∂t undefined at EPI=0
- Requirement: Start with generator {AL, NAV, REMESH}
- Rationale: Cannot evolve from nothing without source
- Canonicity: Mathematical necessity
U1b: Closure (Always)
- Physics: Sequences as action potentials need endpoints
- Requirement: End with closure {SHA, NAV, REMESH, OZ}
- Rationale: Must leave system in coherent attractor
- Canonicity: Physical requirement
- Physics: ∫νf·ΔNFR dt must converge
- Requirement: If {OZ, ZHIR, VAL}, then include {IL, THOL}
- Rationale: Without stabilizers, integral diverges leading to fragmentation
- Mathematical basis: Exponential growth without negative feedback
- Canonicity: Integral convergence theorem
- Physics: Resonance requires phase compatibility
- Requirement: If {UM, RA}, verify |φᵢ - φⱼ| ≤ Δφ_max
- Rationale: Antiphase produces destructive interference
- Basis: Invariant #2 + wave physics
- Canonicity: Resonance physics requirement
U4a: Triggers Need Handlers
- Physics: ∂²EPI/∂t² > τ requires control
- Requirement: If {OZ, ZHIR}, include {THOL, IL}
- Rationale: Uncontrolled bifurcation leads to chaos
- Canonicity: Bifurcation theory requirement
U4b: Transformers Need Context
- Physics: Phase transitions need threshold energy
- Requirement: If {ZHIR, THOL}, recent destabilizer (~3 ops)
- Rationale: ΔNFR must be elevated for threshold crossing
- Additional: ZHIR needs prior IL (stable base)
- Canonicity: Threshold physics + timing requirement
- Physics: Hierarchical coupling + chain rule + central limit theorem
- Requirement: For nested EPIs, include stabilizers {IL, THOL} at each level
- Rationale: Parent coherence depends on aggregate child reorganization
- Conservation: C_parent ≥ α · Σ C_child (α ~ 1/√N · η_phase)
- Without stabilizers: Uncorrelated child fluctuations → parent ΔNFR grows → fragmentation
- Canonicity: Mathematical consequence of hierarchical structure
- Physics: Emergent field Φ_s from distance-weighted ΔNFR distribution
- Formula: Φ_s(i) = Σ_{j≠i} ΔNFR_j / d(i,j)² (inverse-square law analog)
- Requirement: Monitor Δ Φ_s < φ ≈ 1.618 (canonical confinement threshold)
- Theory: Δ Φ_s < φ ≈ 1.618 from Universal Tetrahedral Correspondence (φ ↔ Φ_s)
- Theoretical ceiling: Δ Φ_s < 2.0 = e^ln(2) (binary escape threshold, beyond recovery)
- Derivation: Harmonic confinement principle - structural potential bounded by golden ratio
- Validation: Comprehensive test suite confirms harmonic fragmentation behavior
- Mechanism: Passive equilibrium - grammar acts as confinement, not attraction
- Usage: Telemetry-based safety check (read-only, not sequence constraint)
- Typical: Valid sequences maintain Δ Φ_s ≈ 0.6 (37% of φ threshold)
- Canonicity: Theoretically derived + experimentally validated
- See: UNIFIED_GRAMMAR_RULES.md for complete U6 specification
See: UNIFIED_GRAMMAR_RULES.md for complete derivations
C(t): Total Coherence [0, 1]
- Global network stability (fundamental)
- C(t) > MIN_BUSINESS_COHERENCE ≈ 0.7506 = strong coherence (e×φ)/(π+e)
- C(t) < THOL_MIN_COLLECTIVE_COHERENCE = 1/(π+1) ≈ 0.2415 = fragmentation risk
- CANONICAL: Primary stability indicator
Si: Sense Index [0, 1+]
- Capacity for stable reorganization
- Si > HIGH_CORRELATION_THRESHOLD = 0.8 = excellent stability
- Si < si_lo × 1.5 ≈ 0.4 = changes may cause bifurcation (derived from 1.5/(π+γ))
- CANONICAL: Reorganization capacity predictor
The Structural Field Tetrad (Φ_s, |∇φ|, Ψ, ξ_C) now has complete mathematical foundations with unified complex geometry (Ψ = K_φ + i·J_φ):
Classical Threshold: |Φ_s| < 0.7711
- Theory: von Koch fractal bounds + combinatorial number theory
- Derivation: Experimentally validated constant (0.7711) from Koch snowflake perimeter growth analysis. Confirmed across 5 topologies. Canonical source:
src/tnfr/constants/canonical.py::PHI_S_VON_KOCH_THRESHOLD - Physics: Global structural field escape threshold from distance-weighted ΔNFR distribution
- Linear response: |r| = 1.000 to ΔNFR perturbations, confirming 0th-order derivative tower position (see example 39)
- Grammar: U6 telemetry-based safety criterion (passive equilibrium confinement)
Classical Threshold: |∇φ| < 0.1837
- Theory: Kuramoto critical coupling condition in TNFR units
- Derivation: γ/π ≈ 0.1837 from Universal Tetrahedral Correspondence (γ ↔ |∇φ|)
- Physics: Local phase desynchronization / stress proxy field
- Mechanism: Captures dynamics C(t) misses due to scaling invariance
Classical Threshold: |K_φ| < 2.8274
- Theory: TNFR formalism constraints + safety margin analysis
- Derivation: 0.9 × π ≈ 2.8274 (90% of theoretical maximum from wrap_angle bounds)
- Physics: Phase torsion and geometric confinement; flags mutation-prone loci
- Implementation: K_φ = wrap_angle(φ_i - circular_mean(neighbors)) with |K_φ| ≤ π
Classical Thresholds:
- Critical: ξ_C > 1.0000 × diameter (finite-size scaling dominates)
- Watch: ξ_C > π ≈ 3.1416 × mean_distance (RG scaling + dimensional analysis)
- Stable: ξ_C < mean_distance (bulk behavior)
- Theory: Spatial correlation theory + critical phenomena + renormalization group
- Derivation: Universal scaling ratios from correlation function C(r) = A exp(-r/ξ_C)
- 4/4 canonical parameters have rigorous mathematical foundations
- 0% empirical fitting → 100% first-principles derivation
- Universal constants are derived from first principles (π, exponential bounds, fractal ratios)
- Theory-code consistency maintained throughout codebase
- Complete validation via comprehensive test suite (1,655 tests) across 5 topologies
Status: TNFR Structural Field Tetrad mathematical foundations COMPLETE.
Mathematical Discovery: Systematic mathematical audit revealed fundamental field unification opportunities:
- Evidence: r(K_φ, J_φ) = -0.854 to -0.997 (near-perfect anticorrelation)
- Implication: Curvature and current are dual aspects of unified complex field
- Reduction: 6 independent fields → 3 complex fields (mathematical elegance)
- Chirality χ = |∇φ|·K_φ - J_φ·J_ΔNFR (handedness detection)
- Symmetry Breaking 𝒮 = (|∇φ|² - K_φ²) + (J_φ² - J_ΔNFR²) (phase transitions)
- Coherence Coupling 𝒞 = Φ_s · |Ψ| (multi-scale connector)
- Energy Density ℰ = Φ_s² + |∇φ|² + K_φ² + J_φ² + J_ΔNFR²
- Topological Charge 𝒬 = |∇φ|·J_φ - K_φ·J_ΔNFR
- Structural Conservation Law: ∂ρ/∂t + ∇·𝐉 = S_grammar where ρ = Φ_s + K_φ, 𝐉 = (J_φ, J_ΔNFR), and S_grammar → 0 under U1–U6
Main Result: Grammar symmetry (U1–U6) ⟹ Structural conservation law (Noether-like).
- Canonical Module:
src/tnfr/physics/conservation.py— single source of truth for charge density ρ, current divergence div(𝐉), Noether charge Q, energy functional E, Ward identities, Lyapunov stability, and spectral decomposition - Formal Derivation:
theory/STRUCTURAL_CONSERVATION_THEOREM.md— 14-section derivation from nodal equation - Two-Sector Structure: Potential (Φ_s ↔ J_ΔNFR) and Geometric (K_φ ↔ J_φ) sectors coupled through Ψ = K_φ + i·J_φ
- Lyapunov Stability: E = ½Σ(Φ_s² + |∇φ|² + K_φ² + J_φ² + J_ΔNFR²) ⩾ 0 with dE/dt ≤ 0 observed under grammar-compliant evolution (proof sketch; complete proof open)
- Validation: 88 tests, charge drift < 0.03% across tested topologies and seeds
- Diagnostic: Conservation residuals detect and classify grammar violations in real time
Documentation: See theory/STRUCTURAL_CONSERVATION_THEOREM.md
The Grammar-Aware Dynamics system provides proactive U1-U6 enforcement during operator selection, bridging the grammar validation system with the dynamic operator selection layer.
Located in src/tnfr/operators/grammar_dynamics.py, this module provides incremental grammar checking for step-by-step dynamics where operators are selected one at a time per node.
Key capabilities:
- U1a (Initiation): Checked when EPI ≈ 0 and history is empty
- U2 (Convergence): Tracked via destabilizer/stabilizer debt counter over sliding window
- U3 (Resonant Coupling): Phase compatibility required for UM/RA candidates
- U4a (Bifurcation triggers): OZ/ZHIR require handlers in recent context
- U4b (Transformer context): ZHIR/THOL need recent destabilizer (and prior IL for ZHIR)
- U1b/U5/U6: Advisory (whole-sequence or telemetry checks)
Located in src/tnfr/operators/grammar_application.py, this module provides functions for applying operators with grammar enforcement at runtime — pre-validated, grammar-enforced operator application.
Physics basis: Grammar rules derive from the nodal equation ∂EPI/∂t = νf · ΔNFR(t). Proactive enforcement prevents grammar violations before they corrupt graph state, rather than detecting them reactively.
Usage:
from tnfr.operators.grammar_dynamics import GrammarAwareDynamics
from tnfr.operators.grammar_application import apply_glyph_with_grammarThe engine implements automated structural optimization through feedback on the structural manifold.
Located in src/tnfr/engines/self_optimization/engine.py, this component closes the feedback loop using Unified Field Telemetry:
- Monitors the Unified Fields:
- Complex Geometric Field (Ψ): Unifies curvature and transport
- Chirality (χ): Detects structural handedness
- Symmetry Breaking (𝒮): Signals phase transitions
- Coherence Coupling (𝒞): Measures multi-scale integration
- Detects inefficiencies via tensor invariants (Energy Density ℰ, Topological Charge 𝒬).
- Selects the optimal operator sequence from the SDK.
- Executes and verifies improvement.
Usage:
from tnfr.engines.self_optimization import TNFRSelfOptimizingEngine
engine = TNFRSelfOptimizingEngine(G)
# Auto-select and apply best sequence
success, metrics = engine.step(node_id)The Fluent API now includes auto_optimize():
# Fluent self-optimization
net = TNFRNetwork("demo").add_nodes(20).connect_nodes(0.3).auto_optimize()
results = net.measure()The Simple SDK (src/tnfr/sdk/simple.py) exposes the full TNFR physics stack through a minimal API:
from tnfr.sdk import TNFR
# Create and evolve a network
net = TNFR.create(20).ring().evolve(5)
# Structural Field Tetrad (Φ_s, |∇φ|, K_φ, ξ_C)
tetrad = net.tetrad() # -> TetradSnapshot with is_safe(), summary()
fields = net.fields() # -> dict of per-node field arrays
# Conservation laws (Noether charge, Lyapunov stability)
cons = net.conservation() # -> ConservationReport with quality, summary()
# Unified telemetry
telem = net.telemetry() # -> dict with C(t), Si, phase_sync, tetrad
# Tensor invariants & emergent fields
invariants = net.tensor_invariants() # -> energy_density, topological_charge
emergent = net.emergent_fields() # -> chirality, symmetry_breaking, coherence_coupling
# Grammar-aware evolution (proactive U1-U6 enforcement)
net.evolve_grammar_aware(steps=10)
# Integrity monitoring (13/13 operator postconditions)
report = net.integrity_check() # -> dict[str, Any]
# One-shot comprehensive analysis
analysis = TNFR.analyze(net) # -> dict with all metrics + tetrad + conservationDataclasses:
TetradSnapshot: phi_s, grad_phi, k_phi, xi_c, j_phi, j_dnfr +is_safe(),summary()ConservationReport: noether_charge, energy, lyapunov_stable, lyapunov_derivative, conservation_quality +summary()
Physics: This is not "AI magic" but gradient descent on the structural manifold, driven by the nodal equation's pressure term ΔNFR.
These principles define TNFR theoretical consistency and must be maintained. The set has been optimized from 10 to 6 invariants based on mathematical derivation from the nodal equation ∂EPI/∂t = νf · ΔNFR(t):
Consolidates: EPI coherent form + ΔNFR semantics + Node lifecycle
- EPI evolution constraint: Changes occur only via
∂EPI/∂t = νf · ΔNFR(t) - ΔNFR interpretation: Maintains structural pressure semantics
- Node lifecycle: Determined by νf conditions (νf → 0 corresponds to inactivation)
- Grammar basis: U1 (INITIATION & CLOSURE), U2 (CONVERGENCE)
- Mathematical foundation: Direct consequence of nodal equation
- Validation: Verify EPI changes through operators, ΔNFR interpretation, lifecycle conditions
- Phase verification: |φᵢ - φⱼ| ≤ Δφ_max required for coupling operations
- Physical basis: Resonance theory (antiphase produces destructive interference)
- Grammar basis: U3 (RESONANT COUPLING)
- Implementation: src/tnfr/operators/grammar.py::validate_resonant_coupling()
- Validation: Verify phase compatibility before coupling operations
- Operational fractality: EPIs support nesting without identity loss
- Hierarchical coherence: Multi-scale structure preservation required
- Structural constraint: Recursivity and nested organization maintained
- Grammar basis: U5 (MULTI-SCALE COHERENCE)
- Physical foundation: Hierarchical coupling + chain rule + central limit theorem
- Validation: Multi-scale testing with nested EPIs
- Operator sequences: Must satisfy unified grammar U1-U6 validation
- State validity: Operator composition produces mathematically valid TNFR states
- Function mapping: New functions correspond to existing operators or define new operators
- Grammar foundation: U1-U6 rules derived from nodal equation physics
- Validation: Verify operator sequences pass complete grammar validation
Consolidates: Structural units + Metrics exposure
- Units consistency: νf maintained in Hz_str (structural hertz)
- Telemetry requirements: C(t), Si, phase, νf available in monitoring systems
- Dimensional analysis: Proper unit tracking prevents conceptual confusion
- Measurement constraint: Only TNFR-coherent metrics in telemetry
- Validation: Verify frequency assignments and metric availability
- Deterministic evolution: Identical seeds produce identical trajectories
- Operational traceability: Operation logging for analysis and debugging
- Stochastic control: Random elements under seed-based control
- Validation: Verify seed reproducibility and operation traceability
Eliminated: Domain Neutrality (moved to architectural guidelines) Benefits: 40% reduction (10→6), eliminates redundancy, preserves physics-essential constraints Mathematical basis: 3/6 mathematically derived, 2/6 physics-essential, 1/6 operational
Monotonicity Tests:
def test_coherence_monotonicity():
"""Coherence must not decrease C(t) unless in dissonance test."""
C_before = compute_coherence(G)
apply_operator(G, node, Coherence())
C_after = compute_coherence(G)
assert C_after >= C_beforeBifurcation Tests:
def test_dissonance_bifurcation():
"""Dissonance triggers bifurcation when ∂²EPI/∂t² > τ."""
# Apply dissonance
# Check if bifurcation threshold crossed
# Verify handlers present (U4a)Propagation Tests:
def test_resonance_propagation():
"""Resonance increases effective connectivity."""
phase_sync_before = measure_phase_sync(G)
apply_operator(G, node, Resonance())
phase_sync_after = measure_phase_sync(G)
assert phase_sync_after > phase_sync_beforeLatency Tests:
def test_silence_latency():
"""Silence keeps EPI invariant."""
EPI_before = G.nodes[node]['EPI']
apply_operator(G, node, Silence())
step(G, dt=1.0) # Time passes
EPI_after = G.nodes[node]['EPI']
assert np.allclose(EPI_before, EPI_after)Mutation Tests:
def test_mutation_threshold():
"""Mutation changes θ when ΔEPI/Δt > ξ."""
theta_before = G.nodes[node]['theta']
# Create high ΔEPI/Δt condition
apply_operator(G, node, Mutation())
theta_after = G.nodes[node]['theta']
assert theta_after != theta_beforeAlways include tests with nested EPIs (fractality):
def test_nested_epi_coherence():
"""Nested EPIs maintain functional identity."""
# Create parent EPI with sub-EPIs
# Apply operators
# Verify both levels maintain coherencedef test_seed_reproducibility():
"""Same seed produces identical trajectories."""
set_seed(42)
result1 = run_simulation(G, sequence)
set_seed(42)
result2 = run_simulation(G, sequence)
assert_trajectories_equal(result1, result2)This playbook summarizes how TNFR agents (human or AI) should reason and act when modifying code, documentation, or experiments.
- Anchor to the nodal equation: Treat
∂EPI/∂t = νf · ΔNFR(t)as the primary source of truth for dynamics. - Respect the structural triad: Every change must keep EPI (form), νf (structural frequency), and phase (φ/θ) conceptually well-defined.
- Use the structural field tetrad: Interpret behavior using Φ_s, |∇φ|, K_φ, and ξ_C rather than ad-hoc metrics.
- No direct EPI mutation: All structural changes must be expressible as compositions of the 13 canonical operators (AL, EN, IL, OZ, UM, RA, SHA, VAL, NUL, THOL, ZHIR, NAV, REMESH).
- Map new behavior to operators: Any new function or feature must either reuse existing operators or be justified as a new operator with full physics, contracts, and tests.
- Preserve operator semantics: Refactors must not change what each operator does physically (emission, coherence, dissonance, etc.).
- Check sequence validity: All operator sequences must satisfy U1–U6, especially initiation/closure (U1) and convergence/boundedness (U2).
- Guard bifurcations: If you add or modify destabilizers (OZ, ZHIR, VAL), ensure stabilizers (IL, THOL) are present per U2 and U4.
- Verify coupling: Never create or modify couplings (UM, RA) without explicit phase checks
|φᵢ - φⱼ| ≤ Δφ_max(U3).
- Use correct units: νf must remain in Hz_str; do not silently reinterpret or rescale units.
- Keep ΔNFR semantics: Treat ΔNFR as structural pressure, not as a generic ML loss or error gradient.
- Maintain operational fractality: EPIs can nest; avoid flattening or designs that break recursivity and multi-scale structure.
- Fix seeds: All stochastic components must be reproducible via explicit seeding.
- Expose structural telemetry: Prefer metrics in terms of C(t), Si, phase, νf, Φ_s, |∇φ|, K_φ, and ξ_C instead of opaque scores.
- Test monotonicity and safety: Coherence operators must not reduce C(t) (outside explicit dissonance tests); destabilizers must obey U2 and U4 safeguards.
- Accept changes that:
- Increase coherence C(t) or reduce harmful ΔNFR where appropriate.
- Preserve or strengthen compliance with U1–U6 and the structural tetrad.
- Improve traceability from physics → math → code → tests.
- Reject changes that:
- Introduce unexplained empirical fudge factors or magic constants.
- Bypass operators to mutate EPI directly.
- Break phase verification, structural units, or canonical invariants.
- Write everything in English: Code comments, docs, issues, and commit messages must follow the English-only policy for canonical terminology.
- Explain in TNFR terms: When documenting or reviewing, speak in terms of EPI, νf, φ/θ, ΔNFR, operators, grammar rules, and the structural fields.
- Trace every decision: For significant changes, you should be able to point from the modification back to a specific piece of TNFR physics or grammar.
If a proposed change makes the code “prettier” but weakens TNFR fidelity, it must be rejected. If it strengthens structural coherence, traceability, and alignment with the nodal equation and tetrad fields, it should move forward.
- Read documentation (fundamentals, operators, nodal equation)
- Review UNIFIED_GRAMMAR_RULES.md (grammar physics)
- Check existing code for equivalent functionality
- Run test suite to understand current state
- Search first: Check if utility already exists
- Map to operators: New functions → structural operators
- Preserve invariants: All 6 canonical invariants (optimized from 10)
- Add tests: Cover invariants and contracts
- Document: Structural effect before implementation
- Trace physics: Link to TNFR.pdf or UNIFIED_GRAMMAR_RULES.md
Intent: [which coherence is improved]
Operators involved: [Emission|Reception|...]
Affected invariants: [#1-6: Nodal Integrity, Phase Coupling, Fractality, Grammar, Metrology, Reproducibility]
Key changes:
- [bullet list]
Expected risks/dissonances: [and how contained]
Metrics: [C(t), Si, νf, phase] before/after expectations
Equivalence map: [if APIs renamed]
### What it reorganizes
- [ ] Increases C(t) or reduces ΔNFR where appropriate
- [ ] Preserves operator closure and operational fractality
### Evidence
- [ ] Phase/νf logs
- [ ] C(t), Si curves
- [ ] Controlled bifurcation cases
### Compatibility
- [ ] Stable or mapped API
- [ ] Reproducible seed
### Tests
- [ ] Monotonicity (coherence)
- [ ] Bifurcation (if applicable)
- [ ] Propagation (resonance)
- [ ] Multi-scale (fractality)
- [ ] Reproducibility (seeds)Examples of good changes:
- Making phase explicit in couplings (traceability ↑)
- Adding
sense_index()with tests correlating Si ↔ stability - Optimizing
resonance()preserving EPI identity - Refactoring to reduce code duplication while preserving physics
- Adding telemetry without changing structural dynamics
These violate TNFR:
- Recasting ΔNFR as ML "error gradient"
- Replacing operators with non-mapped imperative functions
- Flattening nested EPIs (breaks fractality)
- Coupling without phase verification
- Direct EPI mutation bypassing operators
- Changing units (Hz_str → Hz)
- Adding field-specific assumptions to core
Framework Development: Computational framework for discrete prime-path graph analysis within TNFR structural principles.
Core Mathematical Result: The discrete TNFR operator
- Discrete TNFR-Riemann Operators: Prime path graphs with spectral analysis
- Critical Parameter Theory: Universal convergence to RH critical line
- Computational Protocols: Implementation frameworks
Additional theoretical explorations (documented in theory/TNFR_RIEMANN_RESEARCH_NOTES.md, not yet implemented):
- Thermodynamic formulation, information geometry
- Category-theoretic and topos-theoretic connections
- Functional analysis extensions
- Formal language and symbolic calculus
Computational Framework:
- Core Implementation: src/tnfr/riemann/operator.py
- Demonstration Code: examples/16_riemann_operator_demo.py
- Complete Theory: theory/TNFR_RIEMANN_RESEARCH_NOTES.md
Validation Protocols:
- Eigenvalue Analysis: Numerical verification of critical behavior
- Coherence Testing: Structural stability under parameter variation
This framework represents:
- An experimental research program connecting discrete TNFR operators to number-theoretic structures
-
Numerical evidence of critical parameter convergence
$\sigma_c \to 1/2$ across topologies - A computational platform for exploring spectral approaches to the Riemann Hypothesis
-
An open conjecture (Conjecture 10.1) bridging TNFR spectral zeta to classical
$\zeta(s)$
Status: Experimental research framework with computational implementations. The bridge to classical RH remains conjectural.
When extending TNFR theory:
- Start from physics: Derive from nodal equation or invariants
- Prove canonicity: Show derivation strength (Absolute/Strong)
- Implement carefully: Map clearly to operators
- Test rigorously: All invariants + new predictions
- Document thoroughly: Physics → Math → Code chain
If you believe a new operator is needed:
- Justify physically: What structural transformation does it represent?
- Derive from nodal equation: How does it affect ∂EPI/∂t?
- Check necessity: Can existing operators compose to achieve this?
- Define contracts: Pre/post-conditions
- Map to grammar: Which sets does it belong to?
- Test extensively: All invariants + specific contracts
Example derivation structure:
## Proposed Operator: [Name]
### Physical Basis
[How it emerges from TNFR physics]
### Nodal Equation Impact
∂EPI/∂t = ... [specific form]
### Contracts
- Pre: [conditions required]
- Post: [guaranteed effects]
### Grammar Classification
- Generator? Closure? Stabilizer? ...
### Tests
- [List specific test requirements]Contributing to UNIFIED_GRAMMAR_RULES.md
When adding to grammar documentation:
- Section structure: [Rule] → [Physics] → [Derivation] → [Canonicity]
- Traceability: Link to TNFR.pdf sections, AGENTS.md invariants
- Proofs: Mathematical where Absolute, physical reasoning where Strong
- Examples: Code snippets showing valid/invalid sequences
Issue: "Sequence invalid - needs generator"
- Cause: Starting from EPI=0 without generator (U1a)
- Fix: Add [Emission, Transition, or Recursivity] at start
Issue: "Destabilizer without stabilizer"
- Cause: [Dissonance, Mutation, Expansion] without [Coherence, Self-organization] (U2)
- Fix: Add stabilizer after destabilizers
Issue: "Phase mismatch in coupling"
- Cause: Attempting coupling with |φᵢ - φⱼ| > Δφ_max (U3)
- Fix: Ensure phase compatibility before coupling
Issue: "Mutation without context"
- Cause: Mutation without recent destabilizer (U4b)
- Fix: Add [Dissonance/Expansion] within ~3 operators before Mutation
- Additional: Ensure prior Coherence for stable base
Issue: "C(t) decreasing unexpectedly"
- Cause: Violating monotonicity contract
- Debug: Check if coherence operator applied correctly
- Fix: Verify operator implementation preserves C(t)
Issue: "Node collapse"
- Cause: νf → 0 or extreme dissonance or decoupling
- Debug: Check telemetry: νf history, ΔNFR spikes, coupling loss
- Fix: Apply coherence earlier, ensure sufficient coupling
- Check telemetry: C(t), Si, νf, phase, ΔNFR
- Verify grammar: Does sequence pass U1-U4?
- Inspect operators: Are contracts satisfied?
- Test invariants: Which of 1-6 is violated?
- Trace physics: Does behavior match nodal equation predictions?
Core Theory (Primary References):
- AGENTS.md: PRIMARY SOURCE - Complete TNFR theory including Universal Tetrahedral Correspondence
- Structural Fields and Universal Tetrahedral Correspondence: DETAILED REFERENCE - Formal mathematical treatment
- TNFR.pdf: Original theoretical foundation (in repo)
- UNIFIED_GRAMMAR_RULES.md: Grammar physics U1-U6 derivations
- docs/STRUCTURAL_FIELDS_TETRAD.md: Technical tetrad field implementations
- GLOSSARY.md: Term definitions and quick reference
Implementation Core — Physics:
- src/tnfr/physics/fields.py: Unified Structural Field Tetrad (Φ_s, |∇φ|, Ψ, ξ_C) CANONICAL
- src/tnfr/physics/conservation.py: Structural Conservation Theorem (Noether-like)
- src/tnfr/physics/integrity.py: Closed-loop integrity monitor (13/13 operator postconditions)
- src/tnfr/physics/classical_mechanics.py: Classical limit emergence (Keplerian orbits, Newton's laws)
- src/tnfr/physics/quantum_mechanics.py: Quantum regime emergence (quantization, superposition, uncertainty)
- src/tnfr/physics/gauge.py: Gauge field structure and symmetries
- src/tnfr/physics/phase_transition.py: Phase transitions and critical phenomena
- src/tnfr/physics/variational.py: Variational formulation of structural dynamics
- src/tnfr/physics/dissipative_conservation.py: Conservation laws in dissipative regime
- src/tnfr/physics/signatures.py: Structural energy signatures and fingerprints
- src/tnfr/physics/telemetry.py: Structural field measurement and monitoring
Implementation Core — Grammar (12 modules):
- src/tnfr/operators/grammar.py: Unified grammar U1-U6 validation (public API facade)
- src/tnfr/operators/grammar_validate.py: Main validation entry point (
validate_grammar()) - src/tnfr/operators/grammar_core.py: Core validator implementation (U1-U4 rule logic)
- src/tnfr/operators/grammar_u6.py: U6 Structural Potential Confinement validation
- src/tnfr/operators/grammar_dynamics.py: Incremental grammar-aware dynamic operator selection
- src/tnfr/operators/grammar_application.py: Pre-validated grammar-enforced operator application
- src/tnfr/operators/grammar_context.py: Runtime context for validation and operator tracking
- src/tnfr/operators/grammar_types.py: Enums, exceptions, and validation result types
- src/tnfr/operators/grammar_error_factory.py: Introspection-enriched error reporting (U1-U6 → Invariants 1-6 mapping)
- src/tnfr/operators/grammar_patterns.py: Sequence pattern recognition and diagnostic exemptions
- src/tnfr/operators/grammar_memoization.py: Validation caching (static aspects only, preserves TNFR semantics)
- src/tnfr/operators/grammar_telemetry.py: Grammar constraint telemetry and monitoring
Implementation Core — Operators (56 modules):
- src/tnfr/operators/definitions.py: 13 canonical operators + base class + registry
- src/tnfr/operators/nodal_equation.py: Nodal equation (
∂EPI/∂t = νf·ΔNFR) implementation - src/tnfr/operators/canonical_patterns.py: Bootstrap, Stabilize, Explore, Propagate sequence templates
- src/tnfr/operators/structural_units.py: Hz_str and structural unit definitions
- src/tnfr/operators/hamiltonian.py: Hamiltonian formulation of nodal dynamics
- src/tnfr/operators/lifecycle.py: Node lifecycle management (νf → 0 conditions)
- src/tnfr/operators/health_analyzer.py: Network health diagnostics
- src/tnfr/operators/metrics.py: Operator-level telemetry (C(t), Si, phase, νf)
- src/tnfr/operators/postconditions/: Post-execution contract verification
- src/tnfr/operators/preconditions/: Pre-execution requirement checks
- src/tnfr/operators/strategies/: Strategic operator selection algorithms
- src/tnfr/operators/network_analysis/: Graph topology analysis utilities
Implementation Core — Mathematics & Engines:
- src/tnfr/mathematics/: Nodal equation integration hub
- src/tnfr/dynamics/self_optimizing_engine.py: Automated structural optimization
- src/tnfr/riemann/: TNFR-Riemann program implementation (14 modules)
- src/tnfr/riemann/operator.py: Discrete TNFR-Riemann operators
- src/tnfr/riemann/spectral_proof.py: Spectral convergence proofs
- src/tnfr/riemann/complex_extension.py: Complex plane extensions
- src/tnfr/riemann/spectral_zeta.py: Spectral zeta functions
- src/tnfr/riemann/topology.py: Topology comparison analysis
- src/tnfr/riemann/spectral_conservation.py: Spectral conservation laws
- src/tnfr/riemann/analytical_convergence.py: Analytical convergence analysis
SDK & Applications:
- src/tnfr/sdk/: Simplified & Fluent API with research-grade access (7 modules)
- src/tnfr/sdk/simple.py: TetradSnapshot, ConservationReport, TNFR.analyze(), grammar-aware evolution, integrity monitoring
- src/tnfr/sdk/fluent.py: Fluent API with auto_optimize()
- src/tnfr/sdk/adaptive_system.py: Adaptive system patterns
- examples/: Complete 01-40 sequential tutorial suite (42 files including specialized demos)
- benchmarks/: Production-grade validation suites (14 benchmark scripts)
Development:
- ARCHITECTURE.md: System design principles
- CONTRIBUTING.md: Workflow and standards
- TESTING.md: Test strategy (1,655 tests)
Domain Showcases:
- Network Dynamics: examples/03_network_formation.py
- Operator Sequences: examples/04_operator_sequences.py
- Emergent Phenomena: examples/08_emergent_phenomena.py
- Simplified SDK: examples/10_simplified_sdk_showcase.py
- Classical Mechanics: examples/12_classical_mechanics_demo.py (Keplerian orbits from Nodal Dynamics)
- Quantum Mechanics: examples/13_quantum_mechanics_demo.py (Emergent Quantization from Resonant Stability)
- Uncertainty & Interference: examples/14_uncertainty_and_interference.py (Structural Uncertainty & Double Slit)
- Classical Kinematics: examples/15_train_crossing_demo.py (Two Trains Problem)
- Conservation Laws: examples/17_conservation_law_demo.py (Structural Conservation Theorem)
- TNFR-Riemann Program: examples/16_riemann_operator_demo.py (Critical parameter analysis)
- Riemann Convergence: examples/18_riemann_convergence_proof.py (Spectral convergence proof)
- Topology Comparison: examples/19_topology_comparison.py
- Eigenmode Tetrad: examples/20_eigenmode_tetrad.py
- Complex Extension: examples/21_complex_extension_demo.py
- Spectral Zeta: examples/22_spectral_zeta_demo.py
- Random Ensemble RMT: examples/23_random_ensemble_rmt_demo.py
- Spectral Conservation: examples/24_spectral_conservation_demo.py
- Analytical Convergence: examples/25_analytical_convergence_demo.py
- Gauge Structure: examples/26_gauge_structure_demo.py
- Variational Principle: examples/27_variational_principle_demo.py
- Dissipative Systems: examples/28_dissipative_systems_demo.py
- Lyapunov Stability: examples/29_lyapunov_stability_demo.py
- Self-Optimization: examples/30_self_optimization_demo.py
- Operator-Tetrad Synergy: examples/37_operator_tetrad_synergy.py (Fingerprint matrix, IL-OZ symmetry)
- Grammar-Energy Landscape: examples/38_grammar_energy_landscape.py (Lyapunov refinement)
- Nodal Equation Decomposition: examples/39_nodal_equation_decomposition.py (Dual-lever, Φ_s linear response)
- Arithmetic Number Theory: examples/40_arithmetic_number_theory.py (Primality, pressure components, coherence landscape)
- Production Validation: tests/ (comprehensive test suite)
Newcomer (2 hours) - Start Here:
- Install:
pip install tnfr - Core Theory: Read this file (AGENTS.md) completely - Primary theoretical reference
- Fundamental Theory: Structural Fields and Universal Tetrahedral Correspondence
- Original Theory: TNFR.pdf § 1-2 (paradigm, nodal equation)
- First Run:
python -c "import tnfr; print('TNFR ready!')" - Terminology: Study GLOSSARY.md for definitions
Hands-On Explorer (1 day):
- Sequential Examples: Work through examples/01_hello_world.py to examples/10_simplified_sdk_showcase.py
- Network Dynamics: Explore examples/03_network_formation.py
- Operator Mastery: Study examples/04_operator_sequences.py
- Emergent Patterns: Analyze examples/08_emergent_phenomena.py
- SDK Mastery: Master examples/10_simplified_sdk_showcase.py
Optimization Engineer (2 days):
- Study: src/tnfr/dynamics/self_optimizing_engine.py
- Practice: Explore examples/10_simplified_sdk_showcase.py
- Apply: Use
auto_optimize()in your own networks
Intermediate Developer (1 week):
- Grammar Deep-Dive: UNIFIED_GRAMMAR_RULES.md (U1-U6 complete)
- Tetrad Fields: docs/STRUCTURAL_FIELDS_TETRAD.md
- Operator Study: Implementations in src/tnfr/operators/definitions.py
- Field Computation: Practice with src/tnfr/physics/fields.py tetrad
- SDK Usage: Fluent API patterns in src/tnfr/sdk/
Advanced Researcher (ongoing):
- Complete Theory: TNFR.pdf + UNIFIED_GRAMMAR_RULES.md mastery
- Tetrad Mastery: All four unified fields (Φ_s, |∇φ|, Ψ=K_φ+i·J_φ, ξ_C) + complex field validation
- TNFR-Riemann Program: theory/TNFR_RIEMANN_RESEARCH_NOTES.md complete framework study
- Architecture: ARCHITECTURE.md + complete codebase exploration
- Research Contribution: Analyze benchmark methodologies in benchmarks/
- Extension Development: Create new domain applications using SDK
- Theoretical Extensions: Propose new operators or fields with full derivations
Production User (immediate):
- Quick Start:
pip install tnfrfor full TNFR power - SDK Usage:
from tnfr.sdk import TNFR; net = TNFR.create(10).random(0.3) - Integration: Import specific modules for your domain
- Examples: Study examples/10_simplified_sdk_showcase.py for patterns
- Monitoring: Implement tetrad field telemetry in your applications
CANONICAL Status (Updated 2025-11-12): Four Promoted Fields
- Global structural potential, passive equilibrium states
- Safety criterion (U6 telemetry): Δ Φ_s < φ ≈ 1.618 (canonical confinement); theoretical ceiling: 2.0 = e^ln(2) (binary escape)
- Per-node safety: |Φ_s| < 0.7711 (von Koch fractal bound)
- For full physics, equations, and validation, see
docs/STRUCTURAL_FIELDS_TETRAD.md.
- Local phase desynchronization / stress proxy
- Safety criterion: |∇φ| < γ/π ≈ 0.1837 for stable operation (Kuramoto critical coupling in TNFR units)
- For formal definition and evidence, see
docs/STRUCTURAL_FIELDS_TETRAD.md.
Critical Discovery: C(t) = 1-(σ_ΔNFR/ΔNFR_max) is invariant to proportional scaling. |∇φ| correlation validated against alternative metrics (max_ΔNFR, mean_ΔNFR, Si) that capture dynamics C(t) misses.
Usage:
- Import from src/tnfr/physics/fields.py
- Compute via
compute_phase_gradient(G)[CANONICAL] - Monitor alongside Φ_s for comprehensive structural health
Documentation: See docs/STRUCTURAL_FIELDS_TETRAD.md for full validation details.
- Phase torsion and geometric confinement; flags mutation-prone loci
- Safety criteria: |K_φ| ≥ 2.8274 (local fault zones); multiscale safety via
k_phi_multiscale_safety - See
docs/STRUCTURAL_FIELDS_TETRAD.mdfor definitions, asymptotic freedom evidence, and thresholds.
Safety criteria (telemetry-based):
- Local: |K_φ| ≥ 2.8274 flags confinement/fault zones
- Multiscale: safe if either (A) α>0 with R² ≥ 0.5, or (B) observed var(K_φ) within tolerance of expected 1/r^α given α_hint ≈ 2.76
Usage:
- Import from src/tnfr/physics/fields.py
- Compute via
compute_phase_curvature(G)[CANONICAL] - Optional multiscale check:
k_phi_multiscale_safety(G, alpha_hint=2.76)
Documentation: See benchmarks/phase_curvature_investigation.py for empirical validation.
- Spatial correlation scale of local coherence; quantifies approach to critical points
- Safety cues: ξ_C > system diameter (critical), ξ_C > 3 × mean distance (watch), ξ_C < mean distance (stable)
- For full derivation and experimental validation, see
docs/STRUCTURAL_FIELDS_TETRAD.mdand benchmark validation results.
RESEARCH-PHASE Fields (NOT CANONICAL):
Currently none. All four structural fields have achieved CANONICAL status:
- Φ_s (Nov 2025): Global structural potential
- |∇φ| (Nov 2025): Phase gradient / local desynchronization
- K_φ (Nov 2025): Phase curvature / geometric confinement
- ξ_C (Nov 2025): Coherence length / spatial correlations
The Unified Structural Field Tetrad (Φ_s, |∇φ|, Ψ, ξ_C) provides complete multi-scale characterization of TNFR network state across global, local, unified geometric-transport, and spatial correlation dimensions.
1. Physics First: Every feature must derive from TNFR physics 2. No Arbitrary Choices: All decisions traceable to nodal equation or invariants 3. Coherence Over Convenience: Preserve theoretical integrity even if code is harder 4. Reproducibility Always: Every simulation must be reproducible 5. Document the Chain: Theory → Math → Code → Tests
When making any decision:
def should_implement(feature):
"""Decision framework for TNFR changes."""
# 1. Does it strengthen TNFR fidelity?
if weakens_tnfr_fidelity(feature):
return False # Reject, even if "cleaner"
# 2. Does it map to structural operators?
if not maps_to_operators(feature):
return False # Must map or be new operator
# 3. Does it preserve invariants?
if violates_invariants(feature):
return False # Hard constraint
# 4. Is it derivable from physics?
if not derivable_from_physics(feature):
return False # Organizational convenience ≠ physical necessity
# 5. Is it testable?
if not testable(feature):
return False # No untestable magic
return True # Implement with full documentationThink in patterns, not objects:
- Not "the neuron fires" → "the neural pattern reorganizes"
- Not "the agent decides" → "the decision pattern emerges through resonance"
- Not "the system breaks" → "coherence fragments beyond coupling threshold"
Think in dynamics, not states:
- Not "current position" → "trajectory through structural space"
- Not "final result" → "attractor dynamics"
- Not "snapshot" → "reorganization history"
Think in networks, not individuals:
- Not "node property" → "network-coupled dynamics"
- Not "isolated change" → "resonant propagation"
- Not "local optimum" → "global coherence landscape"
A TNFR expert:
Understands deeply:
- Can derive U1-U6 from nodal equation
- Explains why phase verification is non-negotiable
- Knows the 13 operators and their physics
- Comprehends TNFR-Riemann connection: How discrete prime operators relate to spectral coherence
- Grasps structural coherence: Pattern-based modeling as alternative to object-based description
Implements rigorously:
- Every function maps to operators
- All changes preserve invariants
- Tests cover contracts and invariants
Documents completely:
- Physics → Code traceability clear
- Examples work across domains
- New developers can understand
Thinks structurally:
- Reformulates problems in TNFR terms
- Proposes resonance-based solutions
- Identifies coherence patterns
Maintains integrity:
- Rejects changes that weaken TNFR
- Prioritizes theoretical consistency
- Values reproducibility over speed
If a change "prettifies the code" but weakens TNFR fidelity, it should not be accepted. If a change strengthens structural coherence and paradigm traceability, it should proceed.
TNFR models coherent dynamic patterns. Development practices should reflect this framework.
Version: 0.0.3.3
Last Updated: 2026-03-07
Status: CANONICAL - Primary reference for TNFR agent guidance
PyPI Release: STABLE - Available via pip install tnfr
Production Ready: Complete Tetrad Fields + Unified Grammar U1-U6 + Simplified SDK + Grammar-Aware Dynamics + Structural Conservation Theorem + Integrity Monitor
Grammar Policy (English Only): All documentation, code comments, commit messages, issues, and pull request descriptions must be written in English. Non-English text is permitted only within verbatim quotations of external sources or raw experimental data. Mixed-language normative content will be rejected. This ensures a single canonical terminology set for TNFR physics and grammar.