Skip to content

Commit ead485e

Browse files
Copilotfermga
andcommitted
Document Invariant #5 explicitly in metabolism.py propagation code
Co-authored-by: fermga <203334638+fermga@users.noreply.github.com>
1 parent b15336b commit ead485e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/tnfr/operators/metabolism.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,12 @@ def propagate_subepi_to_network(
259259
TNFR Principle: "Sub-EPIs propagate to coupled neighbors, triggering their
260260
own bifurcations when ∂²EPI/∂t² > τ" (canonical THOL dynamics).
261261
262+
**AGENTS.md Invariant #5**: No coupling is valid without explicit phase
263+
verification. This function enforces phase compatibility before propagation:
264+
- Computes coupling_strength = 1.0 - (|Δθ| / π) using angle_diff()
265+
- Rejects neighbors with coupling_strength < threshold (antiphase blocked)
266+
- Ensures resonance physics: only phase-aligned nodes receive sub-EPIs
267+
262268
Propagation mechanism:
263269
1. Select neighbors with sufficient coupling (phase alignment)
264270
2. Compute attenuation based on coupling strength
@@ -300,11 +306,14 @@ def propagate_subepi_to_network(
300306
for neighbor in neighbors:
301307
neighbor_theta = float(get_attr(G.nodes[neighbor], ALIAS_THETA, 0.0))
302308

303-
# Compute coupling strength (phase alignment)
309+
# INVARIANT #5: Phase verification before coupling
310+
# Compute coupling strength based on phase alignment
311+
# coupling_strength ∈ [0, 1]: 1 = in-phase, 0 = antiphase
304312
phase_diff = abs(angle_diff(neighbor_theta, parent_theta))
305313
coupling_strength = 1.0 - (phase_diff / math.pi)
306314

307-
# Propagate only if sufficiently coupled
315+
# Propagate only if sufficiently coupled (phase-aligned)
316+
# Antiphase neighbors (Δθ ≈ π) have coupling_strength ≈ 0, blocked by threshold
308317
if coupling_strength >= min_coupling_strength:
309318
# Attenuate sub-EPI based on distance and coupling
310319
attenuated_epi = sub_epi_magnitude * attenuation_factor * coupling_strength

0 commit comments

Comments
 (0)