Skip to content

Commit e8ca6bb

Browse files
authored
Merge pull request #2906 from fermga/copilot/documentar-operadores-canonicos
Catalog 13 canonical TNFR operators with anti-patterns, compatibility matrix, and executable examples
2 parents a79e289 + 52bf2f0 commit e8ca6bb

File tree

6 files changed

+1511
-14
lines changed

6 files changed

+1511
-14
lines changed

docs/grammar/03-OPERATORS-AND-GLYPHS.md

Lines changed: 297 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,25 @@ Emission()(G, 0)
9393
print(f"EPI after emission: {G.nodes[0]['EPI']:.3f}") # > 0
9494
```
9595

96+
### Anti-Patterns
97+
```python
98+
# ✗ WRONG: Using Emission in middle of sequence without purpose
99+
[Emission, Coherence, Emission, Coherence, Silence] # Redundant second emission
100+
101+
# ✓ CORRECT: Single emission to initialize
102+
[Emission, Coherence, Silence]
103+
```
104+
105+
### Relationships
106+
- **Can precede**: All operators (generator role)
107+
- **Should follow**: Nothing (starts sequences from vacuum/dormant state)
108+
- **Often followed by**: Coherence (IL) to stabilize new structure
109+
110+
### Test References
111+
- `tests/unit/operators/test_emission_irreversibility.py` - Structural irreversibility
112+
- `tests/unit/operators/test_emission_metrics.py` - EPI and νf validation
113+
- `tests/unit/operators/test_emission_preconditions.py` - Precondition enforcement
114+
96115
---
97116

98117
## 2. Reception (EN) 📡
@@ -143,6 +162,27 @@ Reception()(G, 0) # Node 0 receives from node 1
143162
print(f"EPI after reception: {G.nodes[0]['EPI']:.3f}")
144163
```
145164

165+
### Anti-Patterns
166+
```python
167+
# ✗ WRONG: Reception without coupling (no network connectivity)
168+
G = nx.Graph()
169+
G.add_node(0, EPI=0.5, vf=1.0, theta=0.0, dnfr=0.0)
170+
Reception()(G, 0) # No neighbors - violates precondition
171+
172+
# ✓ CORRECT: Couple first, then receive
173+
Coupling()(G, 0, 1)
174+
Reception()(G, 0)
175+
```
176+
177+
### Relationships
178+
- **Must precede**: Coupling (UM) or existing network connectivity
179+
- **Can follow**: Any operator that establishes network structure
180+
- **Often follows**: Coupling (UM) to receive from newly coupled nodes
181+
182+
### Test References
183+
- `tests/unit/operators/test_reception_preconditions.py` - Network connectivity validation
184+
- `tests/unit/operators/test_reception_sources.py` - Source integration correctness
185+
146186
---
147187

148188
## 3. Coherence (IL) 🔒
@@ -190,6 +230,30 @@ Coherence()(G, 0)
190230
print(f"ΔNFR after coherence: {G.nodes[0]['dnfr']:.3f}") # Reduced
191231
```
192232

233+
### Anti-Patterns
234+
```python
235+
# ✗ WRONG: Coherence without stabilization target
236+
[Emission, Coherence, Coherence, Coherence] # Redundant, no new structure to stabilize
237+
238+
# ✗ WRONG: Coherence on EPI=0 node
239+
G.add_node(0, EPI=0.0, vf=1.0, theta=0.0, dnfr=0.0)
240+
Coherence()(G, 0) # Violates precondition: EPI > 0
241+
242+
# ✓ CORRECT: Coherence after structure creation/destabilization
243+
[Emission, Dissonance, Coherence, Silence] # Stabilizes after destabilization
244+
```
245+
246+
### Relationships
247+
- **Must precede**: Any operator that requires stable base (especially ZHIR)
248+
- **Should follow**: Destabilizers (OZ, VAL, ZHIR) per U2
249+
- **Can follow**: Any operator that modifies structure
250+
251+
### Test References
252+
- `tests/unit/operators/test_coherence_dnfr_reduction.py` - ΔNFR reduction validation
253+
- `tests/unit/operators/test_coherence_preconditions.py` - EPI > 0 requirement
254+
- `tests/unit/operators/test_coherence_ct_tracking.py` - C(t) monotonicity
255+
- `tests/unit/operators/test_coherence_phase_locking.py` - Phase stabilization
256+
193257
---
194258

195259
## 4. Dissonance (OZ) ⚡
@@ -245,6 +309,28 @@ for op in sequence:
245309
op(G, 0)
246310
```
247311

312+
### Anti-Patterns
313+
```python
314+
# ✗ WRONG: Dissonance without stabilizer (violates U2)
315+
[Emission, Dissonance, Silence] # Missing Coherence/THOL
316+
317+
# ✗ WRONG: Multiple dissonances without handlers (violates U4a)
318+
[Emission, Dissonance, Dissonance, Silence] # No handlers between
319+
320+
# ✓ CORRECT: Dissonance with proper stabilization
321+
[Emission, Coherence, Dissonance, Coherence, Silence]
322+
```
323+
324+
### Relationships
325+
- **Must follow**: Stabilizers (IL, THOL) in sequence per U2
326+
- **Often precedes**: ZHIR (Mutation) - creates context for transformation
327+
- **Can close**: Sequences (U1b role)
328+
329+
### Test References
330+
- `tests/unit/operators/test_dissonance_preconditions.py` - EPI threshold validation
331+
- `tests/unit/operators/test_destabilizer_telemetry.py` - ΔNFR increase tracking
332+
- `tests/unit/operators/test_graduated_destabilizer_windows.py` - U2 compliance
333+
248334
---
249335

250336
## 5. Coupling (UM) 🔗
@@ -299,6 +385,27 @@ Coupling()(G, 0, 1)
299385
print(f"Nodes coupled: {G.has_edge(0, 1)}") # True
300386
```
301387

388+
### Anti-Patterns
389+
```python
390+
# ✗ WRONG: Coupling without phase verification (violates U3)
391+
G.add_node(0, EPI=0.5, vf=1.0, theta=0.0, dnfr=0.0)
392+
G.add_node(1, EPI=0.6, vf=1.0, theta=np.pi, dnfr=0.0) # Antiphase!
393+
Coupling()(G, 0, 1) # Should fail - destructive interference
394+
395+
# ✓ CORRECT: Phase verification before coupling
396+
validate_resonant_coupling(G, 0, 1) # Explicit check
397+
Coupling()(G, 0, 1)
398+
```
399+
400+
### Relationships
401+
- **Requires**: Phase verification (U3) via `validate_resonant_coupling()`
402+
- **Often precedes**: Reception (EN), Resonance (RA)
403+
- **Enables**: Network information flow
404+
405+
### Test References
406+
- `tests/unit/operators/test_coupling_preconditions.py` - Phase compatibility validation
407+
- `tests/unit/operators/test_coupling_metrics.py` - Edge creation verification
408+
302409
---
303410

304411
## 6. Resonance (RA) 🌊
@@ -347,6 +454,33 @@ Resonance()(G, 0, 1) # Then resonate
347454
print("Pattern propagated through resonance")
348455
```
349456

457+
### Anti-Patterns
458+
```python
459+
# ✗ WRONG: Resonance without coupling (no edges)
460+
G = nx.Graph()
461+
G.add_node(0, EPI=0.5, vf=1.0, theta=0.0, dnfr=0.0)
462+
G.add_node(1, EPI=0.6, vf=1.0, theta=0.1, dnfr=0.0)
463+
Resonance()(G, 0, 1) # No edge exists - violates precondition
464+
465+
# ✗ WRONG: Resonance with incompatible phases (violates U3)
466+
G.add_node(2, EPI=0.5, vf=1.0, theta=np.pi, dnfr=0.0) # Antiphase
467+
G.add_edge(0, 2)
468+
Resonance()(G, 0, 2) # Destructive interference
469+
470+
# ✓ CORRECT: Couple first, verify phases, then resonate
471+
Coupling()(G, 0, 1) # Creates edge with phase check
472+
Resonance()(G, 0, 1) # Amplifies
473+
```
474+
475+
### Relationships
476+
- **Requires**: Existing coupling (edges) and phase compatibility (U3)
477+
- **Often follows**: Coupling (UM)
478+
- **Effect**: Amplifies coherent patterns without altering identity
479+
480+
### Test References
481+
- `tests/integration/test_coherence_operator_integration.py` - Propagation validation
482+
- Phase verification enforced by grammar system
483+
350484
---
351485

352486
## 7. Silence (SHA) 🔇
@@ -393,6 +527,30 @@ Silence()(G, 0) # Freeze state
393527
print(f"νf after silence: {G.nodes[0]['vf']:.3f}") # ≈ 0
394528
```
395529

530+
### Anti-Patterns
531+
```python
532+
# ✗ WRONG: Silence in middle without reactivation
533+
[Emission, Silence, Coherence] # Node frozen, can't apply Coherence
534+
535+
# ✗ WRONG: Silence without prior stabilization
536+
[Emission, Dissonance, Silence] # Freezing unstable state
537+
538+
# ✓ CORRECT: Silence as final closure after stabilization
539+
[Emission, Coherence, Silence]
540+
541+
# ✓ CORRECT: Reactivation after silence
542+
[Emission, Silence, Emission, Coherence, Silence] # Reactivate with AL
543+
```
544+
545+
### Relationships
546+
- **Closes**: Sequences (U1b role)
547+
- **Should follow**: Stabilization (IL, THOL)
548+
- **Reactivation**: Requires generator (AL, NAV, REMESH)
549+
550+
### Test References
551+
- Latency/reactivation tested in emission tests
552+
- νf → 0 enforced by operator implementation
553+
396554
---
397555

398556
## 8. Expansion (VAL) 📈
@@ -437,6 +595,27 @@ sequence = [
437595
]
438596
```
439597

598+
### Anti-Patterns
599+
```python
600+
# ✗ WRONG: Expansion without stabilizer (violates U2)
601+
[Emission, Expansion, Silence] # Missing IL/THOL
602+
603+
# ✗ WRONG: Multiple expansions without stabilization
604+
[Emission, Expansion, Expansion, Silence] # Unbounded growth
605+
606+
# ✓ CORRECT: Each expansion balanced
607+
[Emission, Expansion, Coherence, Expansion, Coherence, Silence]
608+
```
609+
610+
### Relationships
611+
- **Requires**: Stabilizer (IL, THOL) per U2
612+
- **Often follows**: Emission or Reception (adding capacity)
613+
- **Inverse**: Contraction (NUL) reduces complexity
614+
615+
### Test References
616+
- `tests/unit/operators/test_destabilizer_telemetry.py` - ΔNFR increase validation
617+
- `tests/unit/operators/test_graduated_destabilizer_windows.py` - U2 compliance
618+
440619
---
441620

442621
## 9. Contraction (NUL) 📉
@@ -479,6 +658,29 @@ sequence = [
479658
]
480659
```
481660

661+
### Anti-Patterns
662+
```python
663+
# ✗ WRONG: Contraction on low-dimensional EPI
664+
G.add_node(0, EPI=0.5, vf=1.0, theta=0.0, dnfr=0.0) # Scalar EPI
665+
Contraction()(G, 0) # Cannot reduce below dim=1
666+
667+
# ✗ WRONG: Excessive contraction losing information
668+
[Emission, Expansion, Contraction, Contraction, Contraction] # Over-simplification
669+
670+
# ✓ CORRECT: Balanced complexity management
671+
[Emission, Expansion, Contraction, Coherence, Silence]
672+
```
673+
674+
### Relationships
675+
- **Inverse**: Expansion (VAL) - manages complexity bidirectionally
676+
- **Not a destabilizer**: Reduces complexity without requiring stabilizers
677+
- **Often follows**: Expansion or complex transformations
678+
679+
### Test References
680+
- `tests/unit/operators/test_contraction.py` - Dimensionality reduction
681+
- `tests/unit/operators/test_contraction_preconditions.py` - dim(EPI) > 1 validation
682+
- `tests/unit/operators/test_contraction_density_metrics.py` - Coherence preservation
683+
482684
---
483685

484686
## 10. Self-organization (THOL) 🌱
@@ -531,6 +733,29 @@ sequence = [
531733
]
532734
```
533735

736+
### Anti-Patterns
737+
```python
738+
# ✗ WRONG: THOL without recent destabilizer (violates U4b)
739+
[Emission, Coherence, SelfOrganization(), Silence] # No OZ/VAL/ZHIR within ~3 ops
740+
741+
# ✗ WRONG: THOL without follow-up stabilization
742+
[Emission, Dissonance, SelfOrganization, Silence] # Should add IL after
743+
744+
# ✓ CORRECT: THOL with proper context
745+
[Emission, Coherence, Dissonance, SelfOrganization, Coherence, Silence]
746+
# ^recent destabilizer ^transformer ^stabilizer
747+
```
748+
749+
### Relationships
750+
- **Requires**: Recent destabilizer (~3 ops) per U4b
751+
- **Handles**: Bifurcations from OZ, VAL
752+
- **Creates**: Sub-EPIs (fractal structure)
753+
- **Stabilizes**: System after transformation (U2 role)
754+
755+
### Test References
756+
- `tests/unit/operators/test_thol_coherence.py` - Fractal organization validation
757+
- `tests/unit/operators/test_controlled_bifurcation.py` - U4a handler role
758+
534759
---
535760

536761
## 11. Mutation (ZHIR) 🧬
@@ -584,6 +809,31 @@ sequence = [
584809
]
585810
```
586811

812+
### Anti-Patterns
813+
```python
814+
# ✗ WRONG: ZHIR without prior Coherence (violates U4b)
815+
[Emission, Dissonance, Mutation, Coherence, Silence] # No IL before OZ
816+
817+
# ✗ WRONG: ZHIR without recent destabilizer (violates U4b)
818+
[Emission, Coherence, Mutation, Silence] # No OZ/VAL within ~3 ops
819+
820+
# ✗ WRONG: ZHIR without handler (violates U4a)
821+
[Emission, Coherence, Dissonance, Mutation, Silence] # Missing IL/THOL after
822+
823+
# ✓ CORRECT: All U4b requirements met
824+
[Emission, Coherence, Dissonance, Mutation, Coherence, Silence]
825+
# ^prior IL ^recent dest ^transform ^handler+stab
826+
```
827+
828+
### Relationships
829+
- **Requires**: Prior IL + recent destabilizer + handler (U4b + U4a)
830+
- **Triggers**: Phase transformation (θ → θ')
831+
- **Most constrained**: Strictest grammar requirements of all operators
832+
833+
### Test References
834+
- `tests/unit/operators/test_bifurcation.py` - Transformation validation
835+
- `tests/unit/operators/test_canonical_grammar_rules.py` - U4b compliance
836+
587837
---
588838

589839
## 12. Transition (NAV) ➡️
@@ -625,6 +875,29 @@ sequence = [
625875
]
626876
```
627877

878+
### Anti-Patterns
879+
```python
880+
# ✗ WRONG: NAV without latent structure to activate
881+
G.add_node(0, EPI=0.0, vf=0.0, theta=0.0, dnfr=0.0) # Completely dormant
882+
Transition()(G, 0) # No previous state to transition from
883+
884+
# ✓ CORRECT: NAV activating preserved state
885+
[Emission, Silence, Transition, Coherence, Silence] # Reactivate after silence
886+
887+
# ✓ CORRECT: NAV as regime shift
888+
[Emission, Coherence, Transition, Reception, Silence] # Mode change
889+
```
890+
891+
### Relationships
892+
- **Generator role**: Can start sequences (U1a)
893+
- **Closure role**: Can end sequences (U1b)
894+
- **Dual nature**: Both activator and terminator
895+
- **Often used for**: Regime shifts, mode transitions
896+
897+
### Test References
898+
- Grammar tests validate U1a/U1b dual role
899+
- Latent activation tested in integration tests
900+
628901
---
629902

630903
## 13. Recursivity (REMESH) 🔄
@@ -668,6 +941,30 @@ sequence = [
668941
]
669942
```
670943

944+
### Anti-Patterns
945+
```python
946+
# ✗ WRONG: REMESH without history/previous states
947+
G = nx.Graph()
948+
G.add_node(0, EPI=0.0, vf=1.0, theta=0.0, dnfr=0.0)
949+
Recursivity()(G, 0) # No EPI history to reference
950+
951+
# ✓ CORRECT: REMESH with established patterns
952+
[Emission, Coherence, Emission, Recursivity] # Has history
953+
954+
# ✓ CORRECT: Multi-scale organization
955+
[Emission, Coupling, SelfOrganization, Recursivity] # Fractal + recursive
956+
```
957+
958+
### Relationships
959+
- **Generator role**: Can start sequences (U1a)
960+
- **Closure role**: Can end sequences (U1b)
961+
- **Creates**: Recursive patterns across scales
962+
- **Requires**: Previous EPI states (history)
963+
964+
### Test References
965+
- `tests/unit/operators/test_remesh_operator_integration.py` - Recursive structure validation
966+
- Multi-scale fractality tests
967+
671968
---
672969

673970
## Operator Composition Patterns

0 commit comments

Comments
 (0)