# Global proof preferences#

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

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
```
```>>> from sage.all import *
>>> proof.arithmetic(True)
>>> with proof.WithProof('arithmetic', False):                                # needs sage.libs.pari
...      print((Integer(10)**Integer(1000) + Integer(453)).is_prime())
...      print(Integer(1)/Integer(0))
Traceback (most recent call last):
...
ZeroDivisionError: rational division by zero
>>> proof.arithmetic()
True
```
sage.structure.proof.proof.get_flag(t=None, subsystem=None)[source]#

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
```
```>>> from sage.all import *
>>> from sage.structure.proof.proof import get_flag
>>> get_flag(False)
False
>>> get_flag(True)
True
>>> get_flag()
True
>>> proof.all(False)
>>> get_flag()
False
```