+ case info_flags::positive:
+ case info_flags::negative: {
+ if ((inf==info_flags::positive) && (flags & status_flags::is_positive))
+ return true;
+ else if ((inf==info_flags::negative) && (flags & status_flags::is_negative))
+ return true;
+ if (flags & status_flags::purely_indefinite)
+ return false;
+
+ bool pos = true;
+ for (auto & it : seq) {
+ const ex& factor = recombine_pair_to_ex(it);
+ if (factor.info(info_flags::positive))
+ continue;
+ else if (factor.info(info_flags::negative))
+ pos = !pos;
+ else
+ return false;
+ }
+ if (overall_coeff.info(info_flags::negative))
+ pos = !pos;
+ setflag(pos ? status_flags::is_positive : status_flags::is_negative);
+ return (inf == info_flags::positive? pos : !pos);
+ }
+ case info_flags::nonnegative: {
+ if (flags & status_flags::is_positive)
+ return true;
+ bool pos = true;
+ for (auto & it : seq) {
+ const ex& factor = recombine_pair_to_ex(it);
+ if (factor.info(info_flags::nonnegative) || factor.info(info_flags::positive))
+ continue;
+ else if (factor.info(info_flags::negative))
+ pos = !pos;
+ else
+ return false;
+ }
+ return (overall_coeff.info(info_flags::negative)? !pos : pos);
+ }
+ case info_flags::posint:
+ case info_flags::negint: {
+ bool pos = true;
+ for (auto & it : seq) {
+ const ex& factor = recombine_pair_to_ex(it);
+ if (factor.info(info_flags::posint))
+ continue;
+ else if (factor.info(info_flags::negint))
+ pos = !pos;
+ else
+ return false;
+ }
+ if (overall_coeff.info(info_flags::negint))
+ pos = !pos;
+ else if (!overall_coeff.info(info_flags::posint))
+ return false;
+ return (inf ==info_flags::posint? pos : !pos);
+ }
+ case info_flags::nonnegint: {
+ bool pos = true;
+ for (auto & it : seq) {
+ const ex& factor = recombine_pair_to_ex(it);
+ if (factor.info(info_flags::nonnegint) || factor.info(info_flags::posint))
+ continue;
+ else if (factor.info(info_flags::negint))
+ pos = !pos;
+ else
+ return false;
+ }
+ if (overall_coeff.info(info_flags::negint))
+ pos = !pos;
+ else if (!overall_coeff.info(info_flags::posint))
+ return false;
+ return pos;
+ }
+ case info_flags::indefinite: {
+ if (flags & status_flags::purely_indefinite)
+ return true;
+ if (flags & (status_flags::is_positive | status_flags::is_negative))
+ return false;
+ for (auto & it : seq) {
+ const ex& term = recombine_pair_to_ex(it);
+ if (term.info(info_flags::positive) || term.info(info_flags::negative))
+ return false;
+ }
+ setflag(status_flags::purely_indefinite);
+ return true;
+ }