Skip to content

Commit

Permalink
Merge pull request #638 from vprover/signature-optimization
Browse files Browse the repository at this point in the history
Signature optimization
  • Loading branch information
quickbeam123 authored Jan 8, 2025
2 parents 18c72e7 + 743ab47 commit 1f3a308
Show file tree
Hide file tree
Showing 18 changed files with 245 additions and 491 deletions.
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

0 comments on commit 1f3a308

Please sign in to comment.