def _can_maybe_derive_from(rule, goal_rule):
  """Return True if rule can potentially be used to derive goal_rule."""
  # Don't allow 'reflexive' derivations.
  if rule == goal_rule:
    return False

  if not rule_utils.rhs_can_maybe_derive(rule.source, goal_rule.source):
    return False

  if not rule_utils.rhs_can_maybe_derive(rule.target, goal_rule.target):
    return False

  return True
Return True if rule can potentially be used to derive goal_rule.
language/compgen/nqg/model/induction/derivation_utils.py