     }
     
     internal func f(_ s: S) -> C {
-        return fTable[s] ?? C.zero
+        return fTable[s]!.sum { (t, a) in
+            (s == t) ? a * C(t) : a * f(t)
+        }
     }
     
     internal func f(_ c: C) -> C {

        return c.sum{ (s, a) in a * g(s) }
    }
    
    internal func h(_ s: S) -> C {
        return hTable[s] ?? C.zero
    }
    
    internal func h(_ c: C) -> C {
        return c.sum{ (s, a) in a * h(s) }
    }
    
    internal func isZero(_ c: C) -> Bool {

        for s in done {
            let a1 = g(f(s)) - C(s)
            let a2 = h(C(s).boundary()) + h(s).boundary()
            assert(a1 == a2, "(gf - 1)(\(s)) = \(a1),\n(h∂ + ∂h)(\(s)) = \(a2)\n")
        }
        
        for s in generators {
            let b1 = f(g(s))
            assert(b1 == C(s), "fg(\(s)) = \(b1)\n")
        }
        
        for s in generators.filter({ diff[$0] == nil}) {
            let b = g(s).boundary()
            assert(b == C.zero, "∂s = \(b), should be 0.\n")
        }
    }
}
