// coupled.sy — Tests temporal graph cycle detection
// voltage and recovery are coupled: each reads the other in evolve()

temporal struct FHNNeuron {
    state voltage: Float = -1.0,
    state recovery: Float = -0.5,
    const epsilon: Float = 0.08,
    const a: Float = 0.7,
    const b: Float = 0.8,
}

impl Evolve for FHNNeuron {
    fn evolve(&mut self, dt: Duration) {
        // voltage reads recovery, recovery reads voltage = CYCLE
        self.voltage += (self.voltage - self.voltage ** 3 / 3.0 - self.recovery) * dt.seconds()
        self.recovery += self.epsilon * (self.voltage + self.a - self.b * self.recovery) * dt.seconds()
    }
}

fn main() {
    let mut n = FHNNeuron {}
    for step in 0..1000 {
        n.evolve(0.01.seconds)
    }
    println("Done")
}
