Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signature optimization #638

Merged
merged 11 commits into from
Jan 8, 2025
36 changes: 15 additions & 21 deletions Inferences/Instantiation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,27 +182,21 @@ Term* Instantiation::tryGetDifferentValue(Term* t)
{
TermList sort = SortHelper::getResultSort(t);

try {
if(sort == AtomicSort::intSort()){
IntegerConstantType constant;
if(theory->tryInterpretConstant(t,constant)){
return theory->representConstant(constant+1);
}
} else if(sort == AtomicSort::rationalSort()){
RationalConstantType constant;
RationalConstantType one(1,1);
if(theory->tryInterpretConstant(t,constant)){
return theory->representConstant(constant+one);
}
} else if(sort == AtomicSort::realSort()){
RealConstantType constant;
RealConstantType one(RationalConstantType(1,1));
if(theory->tryInterpretConstant(t,constant)){
return theory->representConstant(constant+one);
}
}
} catch (ArithmeticException&) {
// return 0 as well
if(sort == AtomicSort::intSort()){
IntegerConstantType constant;
if(theory->tryInterpretConstant(t,constant)){
return theory->representConstant(constant+1);
}
} else if(sort == AtomicSort::rationalSort()){
RationalConstantType constant;
if(theory->tryInterpretConstant(t,constant)){
return theory->representConstant(constant + 1);
}
} else if(sort == AtomicSort::realSort()){
RealConstantType constant;
if(theory->tryInterpretConstant(t,constant)){
return theory->representConstant(constant + 1);
}
}

return 0;
Expand Down
3 changes: 2 additions & 1 deletion Inferences/PolynomialEvaluation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,8 @@ Polynom<Number> simplifyPoly(Polynom<Number> const& in, PolyNf* simplifiedArgs)
auto poly = Polynom(std::move(out));
poly.integrity();
return poly;
} catch (ArithmeticException&) {
} catch (DivByZeroException&) {
// TODO can we remove this?
return in.replaceTerms(simplifiedArgs);
}
}
Expand Down
7 changes: 3 additions & 4 deletions Kernel/InterpretedLiteralEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ class InterpretedLiteralEvaluator::ConversionEvaluator
ASSERTION_VIOLATION;
}
}
catch(ArithmeticException&)
catch(DivByZeroException&)
{
return false;
}
Expand Down Expand Up @@ -534,9 +534,8 @@ class InterpretedLiteralEvaluator::TypedEvaluator : public Evaluator
res = TermList(theory->representConstant(resNum));
return true;
}
catch(ArithmeticException&)
catch(DivByZeroException&)
{
DEBUG( "ArithmeticException" );
return false;
}
}
Expand Down Expand Up @@ -571,7 +570,7 @@ class InterpretedLiteralEvaluator::TypedEvaluator : public Evaluator
}
return PredEvalResult::trivial(res);
}
catch(ArithmeticException&)
catch(DivByZeroException&)
{
return PredEvalResult::nop();
}
Expand Down
Loading