def check_occuring_variables(formula,variables_to_consider,allowed_variables) :
  """
  Checks if the intersection of the variables in <formula> with the variables
  in <variables_to_consider> is contained in <allowed_variables>
  
  Parameters
  ----------
  formula : list of list of integers
      The formula to consider.
  variables_to_consider : list of integers
      Those variables in <formula> that shall be considered.
  allowed_variables : list of integers
      Must be contained in <variables_to_consider>. 
      Gives the subset of <variables_to_consider> that may occur in <formula>
  
  Returns
  -------
  True if the intersection of the variables in <formula> with <variables_to_consider>
  is contained in <allowed_variables>

  """
  variable_set=set(allowed_variables)
  for clause in formula :
    variables_in_clause = {abs(l) for l in clause if abs(l) in variables_to_consider}
    if not variables_in_clause <= variable_set:
      return False, [v for v in variables_in_clause if not v in variable_set]   
  return True, []