Logic of the ASM Simulation