Esempio n. 1
0
ord_RESULT rpos_ContCompare(CONTEXT C1, TERM T1, CONTEXT C2, TERM T2)
/**************************************************************
  INPUT:   Two contexts and two terms.
  RETURNS: The relation between the two terms with respect to the
           RPOS ordering:
           ord_GREATER_THAN if <T1> is greater than <T2>,
	   ord_EQUAL        if both terms are equal,
           ord_SMALLER_THAN if <T2> is greater than <T1> and
	   ord_UNCOMPARABLE otherwise.
  EFFECT:  Variable bindings are considered.
  CAUTION: The precedence from the order module is used to determine
           the precedence of symbols!
***************************************************************/
{
  ord_RESULT result;

  T1 = cont_Deref(&C1, T1);
  T2 = cont_Deref(&C2, T2);

  result = rpos_ContGreaterEqual(C1, T1, C2, T2);
  if (!ord_IsUncomparable(result))
    return result;
  else if (rpos_ContGreater(C2, T2, C1, T1))
    return ord_SmallerThan();
  else
    return ord_UNCOMPARABLE;
}
Esempio n. 2
0
ord_RESULT rpos_ContCompareAux(CONTEXT C1, TERM T1, CONTEXT C2, TERM T2, BOOL VarIsConst)
/**************************************************************
  INPUT:   Two contexts and two terms.
  RETURNS: The relation between the two terms with respect to the
           RPOS ordering:
           ord_GREATER_THAN if <T1> is greater than <T2>,
	   ord_EQUAL        if both terms are equal,
           ord_SMALLER_THAN if <T2> is greater than <T1> and
	   ord_UNCOMPARABLE otherwise.
  EFFECT:  Variable bindings are considered.
           If VarIsConst is true variables are interpreted as constants
  CAUTION: The precedence from the order module is used to determine
           the precedence of symbols!
	   If <VarIsConst> is set then variables are interpreted as constants
           with lowest precedence. They are ranked to each other using
           their variable index.
***************************************************************/
{
  ord_RESULT result;
  CONTEXT GlobalC1, GlobalC2;      
  
  GlobalC1 = C1;
  GlobalC2 = C2;
  
  T1 = cont_Deref(GlobalC1, &C1, T1);
  T2 = cont_Deref(GlobalC2, &C2, T2);

  result = rpos_ContGreaterEqual(GlobalC1, C1, T1, GlobalC2, C2, T2, VarIsConst);
  if (!ord_IsUncomparable(result))
    return result;
  else if (rpos_ContGreaterAux(GlobalC2, C2, T2, GlobalC1, C1, T1, VarIsConst))
    return ord_SmallerThan();
  else
    return ord_UNCOMPARABLE;
}
Esempio n. 3
0
ord_RESULT rpos_CompareAux(TERM T1, TERM T2, BOOL VarIsConst)
/**************************************************************
  INPUT:   Two terms, a boolean flag indicating if variables
           of <T1> and <T2> are interpreted as skolem constants
  RETURNS: The relation between the two terms with respect to the
           RPOS ordering:
           ord_GREATER_THAN if <T1> is greater than <T2>,
	   ord_EQUAL        if both terms are equal,
           ord_SMALLER_THAN if <T2> is greater than <T1> and
	   ord_UNCOMPARABLE otherwise.
  CAUTION: The precedence from the order module is used to determine
           the precedence of symbols!
           If <VarIsConst> is set then variables are interpreted as constants
           with lowest precedence. They are ranked to each other using
           their variable index.
***************************************************************/
{
  ord_RESULT result;

  result = rpos_GreaterEqual(T1, T2, VarIsConst);
  if (!ord_IsUncomparable(result))
    return result;
  else if (rpos_Greater(T2, T1, VarIsConst))
    return ord_SmallerThan();
  else
    return ord_UNCOMPARABLE;
}
Esempio n. 4
0
ord_RESULT rpos_Compare(TERM T1, TERM T2)
/**************************************************************
  INPUT:   Two terms.
  RETURNS: The relation between the two terms with respect to the
           RPOS ordering:
           ord_GREATER_THAN if <T1> is greater than <T2>,
	   ord_EQUAL        if both terms are equal,
           ord_SMALLER_THAN if <T2> is greater than <T1> and
	   ord_UNCOMPARABLE otherwise.
  CAUTION: The precedence from the order module is used to determine
           the precedence of symbols!
***************************************************************/
{
  ord_RESULT result;

  result = rpos_GreaterEqual(T1, T2);
  if (!ord_IsUncomparable(result))
    return result;
  else if (rpos_Greater(T2, T1))
    return ord_SmallerThan();
  else
    return ord_UNCOMPARABLE;
}