Global proof preferences#

class sage.structure.proof.proof.WithProof(subsystem, t)#

Bases: object

Use WithProof to temporarily set the value of one of the proof systems for a block of code, with a guarantee that it will be set back to how it was before after the block is done, even if there is an error.

EXAMPLES:

This would hang “forever” if attempted with proof=True:

sage: proof.arithmetic(True)
sage: with proof.WithProof('arithmetic', False):                                # needs sage.libs.pari
....:      print((10^1000 + 453).is_prime())
....:      print(1/0)
Traceback (most recent call last):
...
ZeroDivisionError: rational division by zero
sage: proof.arithmetic()
True
sage.structure.proof.proof.get_flag(t=None, subsystem=None)#

Used for easily determining the correct proof flag to use.

EXAMPLES:

sage: from sage.structure.proof.proof import get_flag
sage: get_flag(False)
False
sage: get_flag(True)
True
sage: get_flag()
True
sage: proof.all(False)
sage: get_flag()
False