-
Notifications
You must be signed in to change notification settings - Fork 258
Open
Description
this fails even though it shouldn't:
i1 : R=QQ[x];
i2 : F=frac R;
i3 : lift(1/123_F,R)
stdio:3:4:(3): error: cannot lift given ring element
i4 : lift(1/123_F,QQ)
stdio:4:4:(3): error: cannot lift given ring element
This can be traced back to frac.cpp
:
bool FractionField::lift(const Ring *Rg,
const ring_elem f,
ring_elem &result) const
{
// Rg = R ---> frac R
// f is an element of frac R.
ring_elem
hdenom; // used in the case when the denominator can be a unit, but not 1
// e.g. when this = frac (QQ[x,y,z]). Is an element of
if (Rg == R_)
{
frac_elem *h = FRAC_VAL(f);
if (R_->is_equal(h->denom, R_->one()))
{
result = R_->copy(h->numer);
return true;
}
else
{
if (R_->is_field())
{
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
// try to lift denominator. If can, can lift, otherwise not.
if (R_->lift(R_, h->denom, hdenom))
{
ring_elem hinv = R_->invert(hdenom);
result = R_->mult(hinv, h->numer);
return true;
}
}
}
}
return false;
}
I suspect the offending line is if (R_->is_field())
which is always false (if R_ is a field, then it's its own fraction field).
Removing it seems to fix the issue, though I'm not sure exactly what's going on. (it should probably test for invertibility of the denominator)
Metadata
Metadata
Assignees
Labels
No labels