class_docstr: Class to run the substitution algorithm from the list of maximal matches.
class_docstr_tok: ["Class","to","run","the","substitution","algorithm","from","the","list","of","maximal","matches","."]
docstr: Set of rules to decide whether the match is to be substitute or not.
  Args:
      circuit_sublist (list): list of the gates matched in the circuit.
      template_sublist (list): list of matched nodes in the template.
      template_complement (list): list of gates not matched in the template.
  Returns:
      bool: True if the match respects the given rule for replacement, False otherwise.
code: def _rules(
      self, circuit_sublist, template_sublist, template_complement
  ):
      """Set of rules to decide whether the match is to be substitute or not.
      Args:
          circuit_sublist (list): list of the gates matched in the circuit.
          template_sublist (list): list of matched nodes in the template.
          template_complement (list): list of gates not matched in the template.
      Returns:
          bool: True if the match respects the given rule for replacement, False otherwise.
      """
  
      if self._quantum_cost(template_sublist, template_complement):
          for elem in circuit_sublist:
              for config in self.substitution_list:
                  if any(elem == x for x in config.circuit_config):
                      return False
          return True
      return False
  
imports: import copy
  import itertools
  from collections import OrderedDict
  from typing import Sequence, Callable
  import numpy
  import pennylane
  from pennylane.transforms import transform
  from pennylane import adjoint
  from pennylane.ops.qubit.attributes import symmetric_over_all_wires
  from pennylane.tape import QuantumTape, QuantumScript
  from pennylane.transforms.commutation_dag import commutation_dag
  from pennylane.wires import Wires
label_desc: Use image node_id 4 for calling the TemplateSubstitution obj's underlying member method code with example usage: obj._rules(circuit_sublist, template_sublist, template_complement) and returns: False, True, False