+
function commit_to_structural_change():
+
+
// Hierarchical filter: three conditions must align
+
event_detected = post_Ca_amplitude > Ca_HIGH // layer 1: did something happen?
+
overflow_sensed = mGluR5_activation == True // layer 2: was it excessive?
+
context_validated = DARPP32_phospho and GluA1_Ser845_primed // layer 3: worth saving?
+
+
// ── Branch 1: LTP — potentiation ──────────────────────────────
+
if event_detected and overflow_sensed and context_validated:
+
+
// Postsynapse: anchor receptors, enlarge spine
+
activate(CaMKII)
+
AMPA_count += receptor_insertion(CaMKII, GluA1_Ser845_primed)
+
spine_volume *= 1.5
+
+
// Presynapse: expand launchpad, increase output reliability
+
active_zone_size *= 1.4 // more docking slots
+
RRP_pool_capacity += pool_expansion(active_zone_size)
+
VGCC_clustering += cluster_beneath_AZ() // tighter Ca²⁺ coupling
+
vesicle_release_prob += 0.1 // driven by VGCC clustering
+
+
// Astrocyte: seal and insulate the channel
+
perisynaptic_distance -= process_retraction() // walls move IN → tighter wrap
+
ECM_integrity += secrete(Glypicans, Thrombospondins)
+
D_serine_tonic_level += upregulate_synthesis() // sustained NMDA priming
+
glutamate_clearance_rate *= 0.85 // tighter wrap → slower diffusion away
+
return "potentiated"
+
+
// ── Branch 2: temporary only — Ca²⁺ rose, no save signal ─────
+
elif event_detected and not context_validated:
+
AMPA_count += transient_insertion() // early-LTP only — reverses in minutes
+
vesicle_release_prob += transient_facilitation()
+
// No astrocyte structural change
+
return "temporary facilitation only"
+
+
// ── Branch 3: LTD — active forgetting ─────────────────────────
+
elif event_detected and not overflow_sensed and not context_validated:
+
+
// Postsynapse: internalize receptors, shrink spine
+
activate(PP1)
+
AMPA_count -= receptor_internalization(PP1)
+
spine_volume *= 0.7
+
+
// Presynapse: dismantle launchpad
+
active_zone_size -= docking_slot_removal()
+
RRP_pool_capacity -= pool_contraction()
+
VGCC_clustering -= scatter_VGCCs() // decouple Ca²⁺ from AZ
+
vesicle_release_prob *= 0.6
+
+
// Astrocyte: dissolve matrix, pull away, cut support
+
ECM_integrity -= secrete(MMPs) // molecular scissors
+
D_serine_tonic_level = 0 // co-agonist supply cut
+
perisynaptic_distance += process_extension() // walls move OUT → loose wrap
+
glutamate_clearance_rate *= 1.2 // looser wrap → faster spillover
+
return "depressed"
+
+
// ── Branch 4: baseline ────────────────────────────────────────
+
else:
+
// All structural variables unchanged — system holds current state
+
return "baseline — no change"
+