Integrate temporal rules into chainer

(btw I didn't know keyvan was going to start working on them when I wrote most of this code, before he started working on them.)