---
include_toc: true
---

// presynapse.md


Expansions and modulations:
  - is expanded and developed by: [AXON](axon.md)
  - is tuned by: [ORGANISM](../../organism.md), organs, modules
  - expands and tunes: [PRE_VGG](pre_vgcc.md)
  - develops _Ca2, _Rrp

  Introduction: 
  The presynaptic bouton releases neurotransmitter and gathers evidence about whether that release was worth strengthening and worth sustaining. Its behavior unfolds across two DAY contexts and the NIGHT scope.

  During DAY, during AP — the bouton releases neurotransmitter. The amount released depends on:
  
  - residual calcium from recent spikes (the fast trace), which sets the release drive;
  - the two retrograde messages from the postsynapse — retro_eCB brakes the drive (the postsynapse is over-driven), retro_NO will later confirm that release reached a responsive target;
  - the availability of both fuel and vesicles — release proceeds only if budget covers the cost and the readily-releasable pool is non-empty. These two shortfalls are read differently: a fuel shortfall on a succeeding release is evidence the bouton needs more endurance; an empty pool with fuel to spare is ordinary short-term depression.
  
  During DAY, during NOT_AP — the bouton consolidates and recovers. With no spike to release, it:
  
  - receives what arrived — latches the retrograde messages, refills its budget from astrocytic lactate and arrived axonal shipment (contested supply);
  - maintains its traces — accumulates eligibility toward a tag, and stabilizes that tag if dopamine has arrived (the bridge toward strength);
  - recovers its readily-releasable pool from the private reserve, between spikes (which is why high-frequency firing depletes faster than it recovers);
  - lets its traces decay, closing the eligibility, endurance, and tagging windows.
  
  During NIGHT — the bouton's ceilings are rewritten. Acting on the evidence gathered across the day, NIGHT raises the bouton's structure (active-zone capacity) where a validated tag accumulated, and its budget capacity (mitochondrial endurance) where fuel repeatedly interrupted a succeeding release. Both draw on the same finite material and energy shipped down the axon, so the bouton's two kinds of growth compete — and whatever is not maintained drifts back down.

# PRESYNAPSE

```Gen

include: 
  pre_vgcc.md

PRESYNAPSE

  type: comprehension

  _pre_fast_trace
  _pre_possible_tag  _pre_possible_intensity_tag

  _pre_tag _pre_intensity_tag

  _pre_dopamine
  _eCB
  _NO

  _RRP
  _NT

  _pre_budget
  _pre_astro_budget
  _pre_axon_budget
  _pre_endurance_need   _pre_endurance_tag
  
    // Intrication
    
      // Scope
    !DAY: INTRICATE [ scope: &ORGANISM.!DAY ]
    !NIGHT: INTRICATE [ scope: &ORGANISM.!NIGHT ]

      // Context  
    *AP: INTRICATE [ context: &SOMA.*AP ]
    *TunPossible: INTRICATE [ context: &NEURON.*TunPossible ] 

      // Tub
    _NT: INTRICATE [ tub: &ASTROSYNAPSE._NT ] 
    _ATP: INTRICATE [ tub: &ASTROCYTE._ATP ] 
    _eCB: INTRICATE [ tub: &POSTSYNAPSE._eCB ]

    // Instantiation

      // Context
    *VcggIncrease: INSTANTIATE [ context: local ]
    *VcggDecrease: INSTANTIATE [ context: local ]
    *Ca2PrePreActiveDecrease: INSTANTIATE [ context: local ]
    *Ca2PreActiveDecrease: INSTANTIATE [ context: local ]
    *RrpPreActiveDecrease: INSTANTIATE [ context: local ]
    *RrpPreActiveDecrease: INSTANTIATE [ context: local ]

      // Tub
    _Ca2: INSTANTIATE [ tub: local, full: 60x, act: 30x, empty: 0x ]
    _Rrp: INSTANTIATE [ tub: local, full: 60x, act: 30x, empty: 0x ]
    _Rp: INSTANTIATE [ tub: local, full: 60x, act: 30x, empty: 0x ]
    _CaTracesHigh: INSTANTIATE [ tub: local, full: 60x, act: 30x, empty: 0x ]
    _CaTracesMedium: INSTANTIATE [ tub: local, full: 60x, act: 30x, empty: 0x ]
    _CaTracesLow: INSTANTIATE [ tub: local, full: 60x, act: 30x, empty: 0x ]

    _Ca2FullDev: INSTANTIATE [ tub: local, full: 60x, act: 30x, empty: 0x ]
    _RrpFullDev: INSTANTIATE [ tub: local, full: 60x, act: 30x, empty: 0x ] // serve al DEV

      // Container
    void: INSTANTIATE [ container: MAIN ] // !DAY
    void: INSTANTIATE [ container: TRACE ] // !DAY
    void: INSTANTIATE [ container: DECAY ] // !DAY
    void: INSTANTIATE [ container: RECOVER ] // !DAY
    void: INSTANTIATE [ container: ADJUST ] // !DAY Tuning
    void: INSTANTIATE [ container: DEVELOP ] // !NIGHT

    // Expansion

    _@pre_vgcc: INSTANTIATE [ tub: EXPAND [ comprehension: PRE_VGCC ], full: 10x, active: 5x, empty: 2x ] // PRE_VGCC, il tub  _@pre_vgcc serve al tuning
    
```
  
## MAIN

```Gen
MAIN

  type: container

  within_scope: !DAY

  // snippet: *AP
    void: INCLUDE [ accumulator: NTreleaseLow, event: act 12x, cost: act 3x ]
    void: INCLUDE [ accumulator: NTreleaseMedium, event: act 9x, cost: act 3x ]
    void: INCLUDE [ accumulator: NTreleaseHigh, event: act 6x, cost: act 3x ]

```

#### *AP

##### NTreleaseLow

```Gen
NTreleaseLow

    type: accumulator
    in_context: *AP

    hypothesis: _Ca2 mediumness AND _Rrp mediumness AND NOT _ATP empty 
      action: [ _Rrp decrease, _NT increase, _ATP decrease ]
      trace: None
      
```

##### NTreleaseMedium

```Gen
NTreleaseMedium

    type: accumulator
    in_context: *AP

    hypothesis: ( _Ca2 fullness AND _Rrp mediumness ) OR 
                ( _Ca2 mediumness AND _Rrp fullness ) AND
                NOT _ATP empty 
      action: [ _Rrp decrease, _NT increase, _ATP decrease ]
      trace: None
```

##### NTreleaseHigh

```Gen
NTreleaseHigh
    type: accumulator

    in_context: *AP

    hypothesis: _Ca2 fullness AND _Rrp fullness  AND 
                NOT _ATP empty
        action: [ _Rrp decrease, NT increase, _ATP decrease ]
        trace: None
```
  
## TRACE | !DAY

```Gen
TRACE

  type: container

  within_scope: !DAY

  // snippet: *AP

    void: INCLUDE [ accumulator: TracesAccLow, event: act 3x, cost: act 3x ]
    void: INCLUDE [ accumulator: TracesAccMedium, event: act 6x, cost: act 3x ]
    void: INCLUDE [ accumulator: TracesAccHigh, event: act 10x, cost: act 3x ]

```

#### *AP

```Gen
Ca2TracesAccuLow
    type: accumulator

    in_context: *AP

    hypothesis: _Ca2 emptiness
      action: [ _CaTraceLow increase ]
      trace: None
```

##### Ca2TracesAccMedium

```Gen
Ca2TracesAccMedium
    type: accumulator

    in_context: *AP

    hypothesis: _Ca2 mediumness
      action: [ _CaTraceMed increase ]
      trace: None
```

##### Ca2TracesAccHigh

```Gen
Ca2TracesAccumulationHigh
    type: accumulator

    in_context: *AP

    hypothesis: _Ca2 fullness
      action: [ _CaTraceHigh increase ]
      trace: None
```

## DECAY

```Gen
MAIN

  type: container

  within_scope: !DAY

  // snippet: NOT *AP
    void: INCLUDE [ accumulator: eCBClearenceMedium, event: act 24x, cost: act 3x ]
    void: INCLUDE [ accumulator: eCBClearenceLow, event: act 48x, cost: act 3x ]

    void: INCLUDE [ accumulator: TracesClearance, event: act 30x, cost: act 3x ]
```

#### NOT *AP

##### eCBClearance

eCB dipende da POST. Tende a modulare l'entrata di Ca2 degli VGCC.

Qui non facciamo un flush di eCB, riduciamo ogni mezzo secondo (context) di un event di questo episodio.

```Gen
eCBClearance: ( act: 24x ) # Slow
    type: accumulator

    in_context: NOT *AP

    hypothesis: NOT _eCB empty
      action: [ _eCB decrease ]
      trace: None
```

##### Ca2TracesClearance

Qui facciamo un flush di CaTraceX. Deve essere fatto a valle del tuning.

```Gen
Ca2TracesClearance
    type: accumulator

    in_context: NOT *TunPossible

    hypothesis: NOT _CaTraceHigh empty
      action: [ _CaTRaceHigh decrease ]
      trace: None

    hypothesis: NOT _CaTraceMedium empty
      action: [ _CaTRaceMedium decrease ]
      trace: None

    hypothesis: NOT _CaTraceLow empty
      action: [ _CaTRaceLow decrease ]
      trace: None
```


## RECOVER

```Gen
RECOVER

  type: container

  within_scope: !DAY

  // snippet: NOT *AP
    £: INCLUDE [ accumulator: RPShuttleLow, event: act 24x, cost: act 3x ]
    £: INCLUDE [ accumulator: RPShuttleMedium, event: act 48x, cost: act 3x ]

    £: INCLUDE [ accumulator: RefillGlutamine, event: act 24x, cost: act 3x ]
```

#### NOT *AP

##### RPShuttleLow

This happens in the seconds loop, once per second.

The "Hard Bottleneck" State. Recruitment is throttled by a lack of signal, a lack of supply, or a lack of space. If even one of these "Near-Stop" conditions is met, the rate cannot exceed "Slow," regardless of the other two conditions.

Rate: 0.00 – 0.25

```Gen
RPShuttleLow
    type: accumulator

    in_context: NOT *AP

    hypothesis: _CaTraceLow fullness OR 
                _RP emptiness OR 
                _Rrp fullness
      action: [ _RP decrease, _Rrp increase ]
      trace: None
```

##### RPShuttleMedium

The "Sub-Optimal" State. The machinery is working, but it's held back by partial limitations. This covers cases where the signal is steady but the "piston" isn't firing at full speed, or where a high vacancy in the RRP (emptiness) forces a low signal to work a bit harder.

Rate: 0.50 – 0.97

```Gen
RPShuttleMedium
    type: accumulator

    in_context: *AP

    hypothesis: ( _CaTraceMedium fullness AND _RP mediumness AND _Rrp mediumness ) OR 
                ( _CaTraceHigh fullness AND _RP mediumness AND _Rrp mediumness ) OR   # signal boost
                ( _CaTraceMedium fullness AND _RP fullness AND _Rrp mediumness ) OR   # supply boost
                ( _CaTraceMedium fullness AND _RP mediumness AND _Rrp emptiness )     # vacancy boost
      action: [ _RP decrease, _Rrp increase ]
      trace: None
```

##### RPShuttleHigh

The "High Performance" State. Multiple systems are optimized, but one is still at a "mediumness" level. This represents an active synapse that hasn't reached its absolute peak because either the supply is only 50% or the \_Rrp isn't empty enough to create that "maximal vacuum" pull.

Rate: 1.25 – 1.94

```Gen
RPShuttleHigh
    type: accumulator

    in_context: *AP

    hypothesis: ( _CaTraceHigh fullness AND _RP fullness AND _Rrp mediumness ) OR   # signal + supply
                ( _CaTraceHigh fullness AND _RP mediumness AND _Rrp emptiness ) OR  # signal + vacancy
                ( _CaTraceMedium fullness AND _RP fullness AND _Rrp emptiness )     # supply + vacancy
      action: [ _RP decrease, _Rrp increase ]
      trace: None
```

##### RefillRPGlutamine

This happens in the minutes loop, once per minute, via the glutamine shuttle from the astrocyte. It is a two-step process across two cells.

Step 1 — astrocyte side
The astrocyte has been accumulating cleared glutamate from the cleft since the last minutes-loop execution. Its glutamine synthetase enzyme converts that glutamate into glutamine, filling the Glutamine_pool. The fraction successfully converted per cycle is conversion_efficiency, which is set by glucose availability and boosted temporarily if the astrocyte calcium wave fired during the preceding seconds:

refill_RP = Glutamine_pool * conversion_efficiency
Glutamine_pool = max(0.0, Glutamine_pool - refill_RP)

Step 2 — presynapse side

The glutamine crosses into the presynapse, where glutaminase converts it back into glutamate. That glutamate is immediately repackaged into vesicles and added to N_RP:

**The asymmetry that makes depletion possible**:

The chain reveals why sustained high-frequency firing eventually depletes the synapse even with all replenishment mechanisms running.

The RRP holds at most `Max_RRP = 20` vesicles. At 20 Hz with strong Ca2, release can draw 2-4 vesicles per spike — potentially exhausting the RRP in under a second. The seconds loop can move vesicles from RP to RRP at a maximum rate of `k_rec_fast = 5 /s`, meaning at most 5 vesicles per second under ideal conditions. Release outpaces recruitment by roughly an order of magnitude during a burst.

The RP holds up to `Max_RP = 200` vesicles — ten times the RRP. At sustained 20 Hz the RP can sustain firing for tens of seconds even after the RRP is repeatedly emptied, as long as recruitment keeps pace. But the minutes loop only refills N_RP once per minute at a rate limited by `Glutamine_pool * conversion_efficiency`. If glucose is low or the astrocyte wave has not fired, this replenishment may add only a fraction of what was consumed.

The result is a three-tier buffer with mismatched timescales:

RRP  — depletes in seconds,   refilled in seconds   (fast but shallow)
RP   — depletes in minutes,   refilled in minutes   (deep but slow)
Gln  — depletes over bursts,  refilled by glucose   (slowest, astrocyte-dependent)

Each tier buys time for the one below it to respond. When all three are depleted simultaneously — which only happens under prolonged high-frequency firing with insufficient glucose — the synapse has no remaining buffer and goes silent until the minutes loop restores the Glutamine_pool.
  
## ADJUST

```Gen
ADJUST

  // qui stiamo attivando e disattivando PRE_VGCC. Fra un massimo full e minimo empty (empty puo' non essere 0)

  type: container
  activity_scope: !DAY

  // snippet: *TunPossible
    @: INCLUDE [ contextor: VgccCheck, event: act 60x ]

    // *VcggIncrease
    @: INCLUDE [ accumulator: VcggIncrease, event:act 10x ]

    // *VcggDecrease
    @: INCLUDE [ accumulator: VcggDecrease, event:act 10x ]
```

#### *TunPossible

##### VgccCheck

Qui controlliamo che ci siano le condizioni per aumentare o diminuire l'attivazione di VGCC

```Gen
VgccCheck

    type contextor
    in_context: *TunPossible

    condition:  _CaTraceHigh fullness
      out_context: *VcggIncrease

    condition:  _CaTraceLow fullness
      out_context: *VcggDecrease
```

#### *VcggIncrease

##### VcggIncrease

```Gen
VcggIncrease
    type: accumulator

    in_context: *VcggIncrease

    hypothesis:  
      action: 
      trace: 
```

#### *VcggDecrease

##### VcggDecrease

```Gen
VcggDecrease
    type: accumulator

    in_context: *VcggDecrease

    hypothesis:  
      action: 
      trace: 
```

## DEVELOP


```Gen

DEVELOP
  type: container

  activity_scope: !NIGHT

    // snippet: *fixed
    @: INCLUDE [ contextor: Ca2Check, event: act 60x ]

    // snippet: *CaFullDecrease
    @: INCLUDE [ accumulator: CaFullDecrease, event: act 12x, cost: act 3x ]
    
    // snippet: *Ca2FullIncrease
    @: INCLUDE [ accumulator: Ca2FullIncrease, event: act 12x, cost: act 3x ]

    @: INCLUDE [ contextor: RrpCheck, event: act 60x ]

    // snippet: *RrpFullDecrease
    @: INCLUDE [ accumulator: RrpFullDecrease, event: act 12x, cost: act 3x ]

    // snippet: *IncreaseRrpFull
    @: INCLUDE [ accumulator: IncreaseRrpFull, event: act 12x, cost: act 3x ]

```

#### *fixed

##### Ca2Check

***Tens Milliseconds Time Scale***

```Gen
Ca2Check

  type: contextor
  
  in_context: *fixed

    condition: ( empty ) 
      out_context: *CaFullDecrease

    condition: ( full) 
      out_context: *Ca2FullIncrease
```

##### *CaFullDecrease

###### CaFullDecrease

```Gen
DecreasePreCa2Full

  type: accumulator

  in_context: *CaFullDecrease

    hypothesis: NOT ( full ) AND NOT ( empty ) 
      action: [ increase,  decrease]
      trace: None
```

##### *Ca2FullIncrease

###### Ca2FullIncrease

```Gen
IncreasePreCa2Full

  type: accumulator
  
  in_context: *Ca2FullIncrease

    hypothesis: NOT ( full ) AND NOT ( empty ) 
      action: [ increase,  decrease]
      trace: None
```

#### *fixed

##### RrpCheck

***Tens Milliseconds Time Scale***

```Gen
RrpCheck

  type: contextor
  
  in_context: *fixed

    condition: ( empty ) 
      out_context: *RrpFullDecrease

    condition: ( full) 
      out_context: *IncreaseRrpFull
```

##### *RrpFullDecrease

###### RrpFullDecrease

```Gen
DecreasePreRrpFull

  type: accumulator

  in_context: *RrpFullDecrease

    hypothesis: NOT ( full ) AND NOT ( empty ) 
      action: [ increase,  decrease]
      trace: None
```

##### *RrpFullIncrease

###### RrpFullIncrease

```Gen
RrpFullIncrease

  type: accumulator

  in_context: *RrpFullIncrease

    hypothesis: NOT ( full ) AND NOT ( empty ) 
      action: [ increase,  decrease]
      trace: None
```
