Skip to content

Commit 7ccb527

Browse files
Copilotfermga
andcommitted
Document REMESH physical dynamics, operator relationships, and grammar implications
Comprehensive documentation of: - Physical behavior from nodal equation (∂EPI/∂t = νf·ΔNFR) - All 13 operator relationships with REMESH (hierarchical, rhizomatic, fractal harmonic) - EN and NUL additions with physical justification - ZHIR post-recursion nature explained - Grammar implications (U1-U4) emerging from physics - Centralized flow with no redundancy (SHA, coherence, pattern recognition) - Fixed test issues with ALIAS_THETA Co-authored-by: fermga <203334638+fermga@users.noreply.github.com>
1 parent af87b72 commit 7ccb527

File tree

2 files changed

+194
-15
lines changed

2 files changed

+194
-15
lines changed

src/tnfr/operators/remesh.py

Lines changed: 189 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,196 @@
1-
"""Adaptive remeshing operators preserving TNFR structural coherence.
2-
3-
This module implements REMESH (Recursivity) - the canonical TNFR operator for
4-
fractal pattern propagation and multi-scale structural identity preservation.
5-
6-
REMESH enables patterns to echo across scales while maintaining coherence, implementing
7-
the theoretical foundation: "What persists at one scale can be rewritten at another,
8-
with coherence propagating structurally, not imposed."
9-
10-
Key capabilities:
1+
"""Canonical REMESH operator: Recursive pattern propagation preserving structural coherence.
2+
3+
REMESH (Recursivity) - Glyph: REMESH
4+
====================================
5+
6+
Physical Foundation
7+
-------------------
8+
From the nodal equation: ∂EPI/∂t = νf · ΔNFR(t)
9+
10+
REMESH implements: **EPI(t) ↔ EPI(t-τ)** (operational fractality)
11+
12+
REMESH enables patterns to echo across temporal and spatial scales while maintaining
13+
coherence. "What persists at one scale can be rewritten at another, with coherence
14+
propagating structurally, not imposed." - El pulso que nos atraviesa
15+
16+
Canonical Physical Behavior
17+
----------------------------
18+
REMESH acts on the nodal equation by creating temporal/spatial coupling:
19+
20+
1. **Memory Activation**: References EPI(t-τ) from structural history
21+
2. **Pattern Recognition**: Identifies similar EPIs across network (structural_similarity)
22+
3. **Coherent Propagation**: Propagates patterns maintaining identity (StructuralIdentity)
23+
4. **Scale Invariance**: Preserves structural properties across reorganizations
24+
25+
Effect on nodal components:
26+
- EPI: Mixed with historical states (EPI_new = (1-α)·EPI_now + α·EPI_past)
27+
- νf: Can increase during memory activation (reactivation of dormant patterns)
28+
- ΔNFR: Implicitly calculated from reorganization (ΔNFR = ΔEPI/νf from nodal equation)
29+
- Phase: Preserved through StructuralIdentity tracking
30+
31+
Operator Relationships (from Nodal Equation Physics)
32+
-----------------------------------------------------
33+
All relationships emerge naturally from how operators affect EPI, νf, ΔNFR, and phase:
34+
35+
### REMESH Hierarchical (Central Control → Periphery)
36+
**Physics**: Controlled replication from center maintaining coherence descendente
37+
38+
1. **IL (Coherence)**: Reduces |ΔNFR| → stabilizes each recursion level
39+
- Relationship: Estabilización multinivel (coherence extended)
40+
- Dynamics: REMESH propagates pattern, IL consolidates at each level
41+
- Sequence: REMESH → IL (recursive propagation → multi-level stabilization)
42+
43+
2. **VAL (Expansion)**: Increases dim(EPI) → structural expansion
44+
- Relationship: Expansión estructural coherente (fractal growth)
45+
- Dynamics: REMESH replicates, VAL expands each replica maintaining form
46+
- Sequence: VAL → REMESH (expand → replicate expanded form)
47+
48+
3. **SHA (Silence)**: νf → 0 → latent memory
49+
- Relationship: Estabilización de red latente (structural memory)
50+
- Dynamics: SHA freezes pattern (∂EPI/∂t → 0), REMESH propagates frozen state
51+
- Sequence: SHA → REMESH (freeze → propagate frozen memory)
52+
- **Critical**: NO functional redundancy - uses existing Silence operator
53+
54+
4. **NUL (Contraction)**: Reduces dim(EPI) → compression
55+
- Relationship: Compresión estructural coherente (fractal distillation)
56+
- Dynamics: Complementary to VAL, reduces dimensionality maintaining identity
57+
- Sequence: NUL → REMESH (compress → replicate compressed essence)
58+
- **Note**: Hierarchical simplification preserving core structure
59+
60+
### REMESH Rhizomatic (Decentralized Propagation)
61+
**Physics**: Propagation without fixed center, by local resonance
62+
63+
1. **OZ (Dissonance)**: Increases |ΔNFR| → exploration
64+
- Relationship: Bifurcación distribuida (distributed bifurcation)
65+
- Dynamics: REMESH + OZ creates decentralized local variations
66+
- Sequence: OZ → REMESH (destabilize → replicate variations)
67+
68+
2. **UM (Coupling)**: φᵢ → φⱼ → structural connection
69+
- Relationship: Acoplamiento multiescala (multi-scale coupling)
70+
- Dynamics: REMESH propagates, UM connects replicas without hierarchy
71+
- Sequence: REMESH → UM (propagate → connect peers)
72+
73+
3. **THOL (Self-organization)**: Creates sub-EPIs → emergence
74+
- Relationship: Auto-organización recursiva (recursive self-organization)
75+
- Dynamics: REMESH + THOL generates emergent structures without center
76+
- Sequence: THOL → REMESH (emerge sub-EPIs → replicate emergent forms)
77+
78+
### REMESH Fractal Harmonic (Perfect Self-Similarity)
79+
**Physics**: Scale-symmetric replication maintaining perfect auto-similitud
80+
81+
1. **RA (Resonance)**: Amplifies coherently → propagation
82+
- Relationship: Resonancia multiescala (multi-scale resonance)
83+
- Dynamics: REMESH replicates, RA amplifies with perfect symmetry
84+
- Sequence: REMESH → RA (replicate → amplify symmetrically)
85+
86+
2. **NAV (Transition)**: Activates latent EPI → regime shift
87+
- Relationship: Transición entre attractores fractales
88+
- Dynamics: REMESH navigates between self-similar attractor states
89+
- Sequence: NAV → REMESH (transition → replicate new regime)
90+
91+
3. **AL (Emission)**: Creates EPI from vacuum → generation
92+
- Relationship: Emisión fractal (fractal emission)
93+
- Dynamics: REMESH + AL generates self-similar patterns from origin
94+
- Sequence: AL → REMESH (emit seed → replicate fractally)
95+
96+
4. **EN (Reception)**: Updates EPI from network → reception
97+
- Relationship: Recepción multi-escala simétrica (symmetric multi-scale reception)
98+
- Dynamics: EN captures patterns from multiple sources → REMESH replicates symmetrically
99+
- Sequence: EN → REMESH (receive multi-scale → propagate symmetrically)
100+
- **Note**: Pre-recursion operator that feeds REMESH
101+
102+
### Operators with Indirect Relationships
103+
104+
**ZHIR (Mutation)**: Present in canonical relationships but NOT in types
105+
- **Physical Reason**: ZHIR is a TRANSFORMER that emerges POST-recursion
106+
- **Dynamics**: REMESH propagates → local variations + destabilizers → ZHIR transforms
107+
- **Grammar**: Requires IL previo + recent destabilizer (U4b)
108+
- **Relationship**: Mutación replicativa (replication facilitates mutation)
109+
- **Conclusion**: Operates AFTER REMESH completes, not during
110+
111+
Grammar Implications from Physical Analysis
112+
--------------------------------------------
113+
REMESH's physical behavior affects unified grammar rules (UNIFIED_GRAMMAR_RULES.md):
114+
115+
### U1: STRUCTURAL INITIATION & CLOSURE
116+
**Physical Basis**: REMESH echoes EPI(t-τ), can activate from dormant/null states
117+
118+
**U1a (Initiation)**: REMESH is a GENERATOR
119+
- Can start sequences when operating on latent structure
120+
- Activates dormant patterns via temporal coupling
121+
- **Rule**: Sequences can begin with REMESH
122+
123+
**U1b (Closure)**: REMESH is a CLOSURE operator
124+
- Distributes structure across scales leaving system in recursive attractor
125+
- Creates self-sustaining multi-scale coherence
126+
- **Rule**: Sequences can end with REMESH
127+
128+
### U2: CONVERGENCE & BOUNDEDNESS
129+
**Physical Basis**: REMESH mixing with historical states can amplify or dampen ΔNFR
130+
131+
**Requirement**: REMESH + destabilizers → must include stabilizers
132+
- Example: REMESH + VAL (expansion) → requires IL (coherence)
133+
- Prevents: Unbounded growth through recursive expansion
134+
- **Rule**: If REMESH precedes/follows VAL, OZ, or ZHIR → require IL or THOL
135+
136+
**Integration Convergence**: ∫ νf · ΔNFR dt must converge
137+
- REMESH temporal mixing: (1-α)·EPI_now + α·EPI_past
138+
- Without stabilizers: Can create positive feedback loop
139+
- **Rule**: Stabilizers ensure convergence of recursive reorganization
140+
141+
### U3: RESONANT COUPLING
142+
**Physical Basis**: REMESH propagates patterns - must verify phase compatibility
143+
144+
**Requirement**: REMESH with UM or RA → verify |φᵢ - φⱼ| ≤ Δφ_max
145+
- REMESH creates replicas that must be phase-compatible for resonance
146+
- Antiphase replicas → destructive interference
147+
- **Rule**: StructuralIdentity.matches() includes phase verification
148+
- **Implementation**: Phase pattern captured and validated during propagation
149+
150+
### U4: BIFURCATION DYNAMICS
151+
**Physical Basis**: REMESH can trigger bifurcation through recursive amplification
152+
153+
**U4a (Triggers Need Handlers)**: REMESH + destabilizers → need handlers
154+
- REMESH → THOL sequence: Recursion enables self-organization
155+
- Must handle emergent sub-EPIs from recursive bifurcation
156+
- **Rule**: REMESH + OZ or ZHIR → require THOL or IL handlers
157+
158+
**U4b (Transformers Need Context)**: ZHIR requires REMESH context
159+
- REMESH creates variations across scales
160+
- ZHIR then transforms local variations (post-recursion)
161+
- **Rule**: ZHIR after REMESH → requires prior IL + recent destabilizer
162+
163+
Centralized Flow - No Redundancy
164+
---------------------------------
165+
This implementation maintains a single, centralized flow:
166+
167+
1. **SHA Integration**: Uses existing Silence operator from definitions.py
168+
- NO reimplementation of SHA functionality
169+
- StructuralIdentity only CAPTURES frozen states, doesn't freeze
170+
- Workflow: Silence() → capture_from_node(is_sha_frozen=True) → validate
171+
172+
2. **Coherence Calculation**: Simplified C(t) for REMESH validation
173+
- Full coherence calculation in tnfr.metrics module
174+
- compute_global_coherence() specific to REMESH fidelity checks
175+
- No duplication with main coherence computation
176+
177+
3. **Pattern Recognition**: Unique to REMESH structural memory
178+
- structural_similarity(): Pattern matching (no operator overlap)
179+
- structural_memory_match(): Network-wide search (REMESH-specific)
180+
- No duplication with network analysis tools
181+
182+
4. **Identity Tracking**: REMESH-specific fractal identity
183+
- StructuralIdentity: Persistent identity across reorganizations
184+
- Captures EPI signature, νf range, phase pattern
185+
- Validates preservation post-recursion
186+
187+
Key Capabilities
188+
----------------
11189
- Structural memory: Pattern recognition across network nodes
12190
- Identity preservation: Fractal lineage tracking across reorganizations
13191
- Coherence conservation: Validating structural fidelity during remeshing
14192
- Multi-modal recursivity: Hierarchical, rhizomatic, and fractal harmonic modes
193+
- Grammar-compliant: All operations respect unified grammar rules (U1-U4)
15194
"""
16195

17196
from __future__ import annotations

tests/unit/operators/test_remesh_canonical.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def test_phase_pattern_matching(self):
223223

224224
set_attr(G.nodes[1], ALIAS_EPI, 0.5)
225225
set_attr(G.nodes[1], ALIAS_VF, 1.0)
226-
set_attr(G.nodes[1], ALIAS_PHASE, math.pi / 2)
226+
set_attr(G.nodes[1], ALIAS_THETA, math.pi / 2)
227227

228228
identity = StructuralIdentity(
229229
epi_signature=0.5,
@@ -241,7 +241,7 @@ def test_phase_pattern_circular_wrap(self):
241241

242242
set_attr(G.nodes[1], ALIAS_EPI, 0.5)
243243
set_attr(G.nodes[1], ALIAS_VF, 1.0)
244-
set_attr(G.nodes[1], ALIAS_PHASE, 0.05) # Near 0
244+
set_attr(G.nodes[1], ALIAS_THETA, 0.05) # Near 0
245245

246246
identity = StructuralIdentity(
247247
epi_signature=0.5,
@@ -310,7 +310,7 @@ def test_capture_from_node_with_phase(self):
310310

311311
set_attr(G.nodes[1], ALIAS_EPI, 0.5)
312312
set_attr(G.nodes[1], ALIAS_VF, 1.0)
313-
set_attr(G.nodes[1], ALIAS_PHASE, math.pi / 4)
313+
set_attr(G.nodes[1], ALIAS_THETA, math.pi / 4)
314314

315315
identity = StructuralIdentity.capture_from_node(G.nodes[1])
316316

@@ -627,5 +627,5 @@ def test_error_message(self):
627627
)
628628

629629
message = str(error)
630-
assert "0.65" in message or "65%" in message
631-
assert "0.85" in message or "85%" in message
630+
assert "0.65" in message or "65%" in message or "65.00%" in message
631+
assert "0.85" in message or "85%" in message or "85.00%" in message

0 commit comments

Comments
 (0)