In a unit-cost random access machine, the no-operation (NOP) command can be simulated using basic \(L O O P\) commands:

Algorithm: No-Operation Command (NOP)

class UCRAM(): # unit-cost random access machine with 3 registers r_i = 0

  def NOP(self):
      self.r_i = self.r_i + 1 #  LOOP register i
      self.r_i = self.r_i - 1  # LOOP register i
  1. Usage for NOP
  2. creating a unit-cost access machine with registers initially set ucram = UCRAM() print(ucram.r_i)

ucram.NOP() # no operation print(ucram.r_i)

  1. will output
  2. 0
  3. 0

Algorithms: 1 2 3 4 5
Examples: 6


Thank you to the contributors under CC BY-SA 4.0!

Github:
bookofproofs


References

Bibliography

  1. Erk, Katrin; Priese, Lutz: "Theoretische Informatik", Springer Verlag, 2000, 2nd Edition