The inferences variable contains the number of inferences performed so far, i.e. the number of rule applications. It is incremented automatically by the inference subroutines. To initialize, simply set to 0.