code: public static boolean areVariablesDistinct(ImmutableList<? extends VariableOrGroundTerm> arguments) {
          Set<Variable> encounteredVariables = new HashSet<>();
  
          for (VariableOrGroundTerm argument : arguments) {
              if (argument instanceof Variable) {
                  if (!encounteredVariables.add((Variable)argument)) {
                      return false;
                  }
              }
          }
          return true;
      }
docs: TODO: explain