Opened 4 years ago

#23312 new defect

documentation and implementation disagree for BooleanPolynomialRing constructor

Reported by: msaaltink Owned by:
Priority: trivial Milestone: sage-8.0
Component: algebra Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

sage: BooleanPolynomialRing?
Signature:      BooleanPolynomialRing(n=None, names=None, order='lex')
Docstring:     
   Construct a boolean polynomial ring with the following parameters:

   INPUT:

   * "n" -- number of variables (an integer > 1)

   * "names" -- names of ring variables, may be a string or
     list/tuple of strings

   * "order" -- term order (default: lex)

So we need n > 1. And the error message for n=0 agrees:

sage: B = BooleanPolynomialRing(0)
[...]
ValueError: Number of variables must be greater than 1.

However, the implementation allows n=1:

sage: B = BooleanPolynomialRing(1)
sage: B
Boolean PolynomialRing in None

and even negative n:

sage: B = BooleanPolynomialRing(-2)
sage: B
Boolean PolynomialRing in None

The n=1 case appears to work fine, so I do not know why it is called out in the documentation. The 'n<0' cases must be a missing error check in the code.

Change History (0)

Note: See TracTickets for help on using tickets.